2

Is this not odd?

Python 3.2.3 (default, Feb  1 2013, 20:24:16) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import enchant
>>> d = enchant.Dict("en_US")
>>> d.check("house")
True
>>> d.check("civilization")
False
>>> d.suggest("civilization")
['civilization', 'civilizations', "civilization's"]
>>> d.provider
<Enchant: Aspell Provider>
>>> d.tag
'en_US'
>>> enchant.list_languages()
['de', 'de_AT', 'de_CH', 'de_DE', 'en', 'en_CA', 'en_GB', 'en_US']

So basically, spell-checking the word "civilization" fails, but when asked to suggest alternatives, enchant (or aspell?) suggests the very same word that it just failed to spell.

EDIT: Using this workaround

def spell(w) : return d.check(w) or w in d.suggest(w)

I can get more sensible answers from pyEnchant, but that seems like a hack to me. However, this doesn't seem to be a pyEnchant problem but rather something to do with aspell itself:

echo "civilization" | aspell -a
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.6.1)
& civilization 3 0: civilization, civilizations, civilization's

Or am I misreading the output here?

EDIT: After this question was closed, I've rephrased it more clearly in this thread.

Community
  • 1
  • 1
Jens
  • 8,423
  • 9
  • 58
  • 78
  • What happens if you try the same thing with the `en_GB` dictionary? – mbatchkarov Apr 05 '13 at 12:05
  • 1
    Yes, it is definitely odd :) – root Apr 05 '13 at 12:06
  • Without knowing the enchant library, it definitely seems odd to me. Maybe file a bug report? – mgilson Apr 05 '13 at 12:09
  • @mbatchkarov: Same thing :) – Jens Apr 05 '13 at 12:11
  • More to the point, I voted to close this as "Not a real question" because you don't really have a concrete question here. This is more of a comment that the package isn't working how you expect it to, and there's not much we can do to help that other than give you a little moral support ... I do hope that you contact the developers of this package and figure out how to get this issue resolved though. – mgilson Apr 05 '13 at 12:11
  • @mgilson Agreed, +1 for being interesting though – jamylak Apr 05 '13 at 12:13
  • @mgilson: It seems that pyEnchant hasn't been maintained for about two years. As for this not being a question: perhaps I ought to ask, "Is this expected behavior?" – Jens Apr 05 '13 at 12:14

0 Answers0