Add a personal word list to program

483 views
Skip to first unread message

Shahin Azad

unread,
Oct 10, 2012, 9:37:14 AM10/10/12
to pyencha...@googlegroups.com
I tried to add a personal word list as a dictionary to my program like this:
    pwl = enchant.request_pwl_dict("mywords.txt")
but after running my program mywords.txt file become to an empty file and my editor didn't do any correction at all. I try it with English language
(That I have it's dictionary in my enchant installation) and it works fine.
I want to have an spell correction on my text editor without install a dictionary in enchant installation. Then I made my own dictionary and I want to use
it as a regular dictionary, but it's not working :-(

Ryan Kelly

unread,
Oct 10, 2012, 4:45:21 PM10/10/12
to pyencha...@googlegroups.com
On 11/10/12 00:37, Shahin Azad wrote:
> I tried to add a personal word list as a dictionary to my program like this:
>
> pwl = enchant.request_pwl_dict("mywords.txt")


I'm not sure I understand. What does your program do with pwl once it
has been created? If you can send through the entire program or a
representative example then I may be of more help.

> but after running my program mywords.txt file become to an empty file

Are you saying that it was created as an empty file? This is the
expected behaviour.

Or are you saying hat its existing contents were overwritten? This
would be a pretty serious bug in pyenchant.

> and my editor didn't do any correction at all.
> I try it with English language
> (That I have it's dictionary in my enchant installation) and it works fine.
> I want to have an spell correction on my text editor without install a dictionary in enchant installation. Then I made my own dictionary and I want to use
> it as a regular dictionary, but it's not working :-(

What editor are you using? I will need more details to be of any help here.


Cheers,

Ryan

Shahin Azad

unread,
Oct 11, 2012, 10:03:34 AM10/11/12
to pyencha...@googlegroups.com
Hi, Thank you for your answer.


> I'm not sure I understand.  What does your program do with pwl once it
> has been created?  If you can send through the entire program or a
> representative example then I may be of more help.

I attached the python source "spell.py".
I used an example from the internet as editor.


> Or are you saying hat its existing contents were overwritten?  This
> would be a pretty serious bug in pyenchant.

Yes. I exactly mean it.

spell.py

Ryan Kelly

unread,
Oct 11, 2012, 5:56:58 PM10/11/12
to pyencha...@googlegroups.com
Yikes! What version of pyenchant are you using, on what platform, and
how did you install it? I recall a bug like this in earlier versions
but I think it was fixed.

Can you please try a small experiment to isolate this behaviour?

* Create a text file named "test.pwl" containing just the
word "hello".

* Enter an interactive python shell and do nothing else but:

import enchant
d = enchant.request_pwl_dict("test.pwl")
print d.check("hello")

* If it printed "False", then print out the enchant version info
and send it through with your reply to help me debug:

print enchant.__version__
print enchant.get_enchant_version()

* Check whether the "test.pwl" file has been overwritten.


I will try out your example script on my machine and report back.


Cheers,

Ryan

Shahin Azad

unread,
Oct 12, 2012, 9:18:16 AM10/12/12
to pyencha...@googlegroups.com
My pyenchant version is 1.6.5. I'm using it on a Linux system with preinstalled enchant 1.5.0.
I installed enchant with pip command.

And after all I did that test you said and it returns False and overwrote my test.pwl file.


Thank you,

  Shahin

Shahin Azad

unread,
Oct 17, 2012, 6:00:20 PM10/17/12
to pyencha...@googlegroups.com
Any hope?

Ryan Kelly

unread,
Oct 18, 2012, 11:59:12 PM10/18/12
to pyencha...@googlegroups.com, Shahin Azad
This is a known bug in enchant 1.5.0:

http://bugzilla.abisource.com/show_bug.cgi?id=12350

Updating to enchant 1.6.0 should fix the problem.


Cheers,

Ryan
Reply all
Reply to author
Forward
0 new messages