0

I want to have a spell check feature in my PyQt4 project and it seems pyenchant is a good choice to do this thing. It's work prefect. but I want to make my own dictionary of words and feed the module with them. Is it possible at all?

after that, how can I make an easy process to use this new dictionary on other computers that want to use my original program? I don't want to make user install some strange program and dictionaries to use my simple program.

PS: I'm on a Linux system.

Jon Clements
  • 138,671
  • 33
  • 247
  • 280
Shahin
  • 1,415
  • 4
  • 22
  • 33

1 Answers1

5

You could use Personal Word List feature. Add words via pwl object:

>>> pwl = enchant.request_pwl_dict("mywords.txt")

Use word list:

>>> d2 = enchant.DictWithPWL("en_US", "mywords.txt")
>>> d2.check("Hello")
True

To install "mywords.txt" use package_data. See Including non-Python files with setup.py

Community
  • 1
  • 1
jfs
  • 399,953
  • 195
  • 994
  • 1,670
  • Yeah, I used it before, but after running my program, all words in the file vanished! I thought maybe I used wrong function. – Shahin Oct 02 '12 at 16:18