Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training #13

Open
mirfan899 opened this issue Jul 7, 2021 · 2 comments
Open

Training #13

mirfan899 opened this issue Jul 7, 2021 · 2 comments

Comments

@mirfan899
Copy link

I tried to follow the training documentation. When I run the

cd data
make all
cd ..

It gives the following error.

python ../tools/spellcheck.py < ../tools/jfleg/dev/dev.src > jflegdev.err
Traceback (most recent call last):
  File "../tools/spellcheck.py", line 30, in <module>
    main()
  File "../tools/spellcheck.py", line 19, in main
    print(d.suggest(w)[0], end=" ")
IndexError: list index out of range
make: *** [Makefile:54: jflegdev.err] Error 1
make: *** Deleting file 'jflegdev.err'

I have the file dev.src in tools/jfleg/dev/

I'm using Python 2 for this experiment as it seems it does not support Python 3.

@mirfan899
Copy link
Author

It seems this is a bug in spellcheck.py code. For example, there is a line in dev.src

the carebendiocside is very harm full for the people . 

enchant gives an empty array for word carebendiocside and the script throws the error.

@mirfan899
Copy link
Author

mirfan899 commented Jul 7, 2021

Here is the fix I am using

def main():
    args = parse_user_args()
    d = enchant.Dict(args.dict)
    for line in sys.stdin:
        for w in line.strip().split():
            if d.check(w) or not w.isalpha():
                print(w, end=" ")
            elif d.suggest(w):
                print(d.suggest(w)[0], end=" ")
        print()

else case can be built. I don't know the logic and context of the script so I'm not using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant