nieldlr / hanzi

HanziJS is a Chinese character and NLP module for Chinese language processing for Node.js
http://hanzijs.com
MIT License
375 stars 56 forks source link

黃 decomposition error #9

Closed djuretic closed 11 years ago

djuretic commented 11 years ago

Trying to do a hanzi.decompose('黃') fails with an error:

        if(components.length == 2){
                     ^
TypeError: Cannot read property 'length' of undefined

That line is in hanzidecomposer.js, graphicalDecomposition method.

I've narrowed the error, before failing the code does 4 components lookups:

Looking up: 黃
Looking up: 黃
Looking up: 廿
Looking up: 卄

but cannot be found on cjk-decomp.txt.

nieldlr commented 11 years ago

Yes, I've got a list of characters going that don't work with the data. I'm going to have manually edit the files to make them work. Sometimes small things, like encoding differences create these errors. I have changed quite a bit of data so far. I'll do this one too.

nieldlr commented 11 years ago

I've fixed this in the latest update. Even if the 卄 could not be found (which is a problem with the data), it falls back to the character that created the lookup.