質問

I'm trying to check a list of tags against the english dictionary. I'm using pyenchant and I keep getting error. It seems to have an error after it reads a "?". I attempted to take out all punctuation by using the string library and the following code:

for punc in string.punctuation:
    title = title.replace(punc,'')

but some how this char which appears to look like a ? is throwing off the dictionary.

Code snippet:

if word not in stopwords.words('english'):
    print word, "=", d.check(word) 
    if d.check(word):       
        tags.append(word.lower())

Response:

Learning = True
Lens = True
Children = True
Pumkincom = False
Pumkin = False

** (process:49042): CRITICAL **: enchant_dict_check: assertion `g_utf8_validate(word, len, NULL)' failed
     ? =

I'm using Python 2.7.3 and pyenchant-1.6.5-py2.7

EDIT: I think I solved this problem by checking to see if len(word)==1 but I would like to know why this happens.

役に立ちましたか?

解決

I faced this problem before, but it was due to non English letters existing in the text I advice you to make sure that word contains only English letters

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top