bwignall/typochecker

Difficulties in using typochecking (and significand)

Closed this issue · 5 comments

I have got back to trying to use this valuable tool (having failed to get it work on Windows 10 - appears to run but does not give any user IO and runs to the end).

So I have found an old machine and fired up Ubuntu 18.04 LTS to try it on *nix (though I had hoped that Python would be portable. Terry Jones RIP).
I have tried using python 2.7 and 3.7 but I'm obviously doing something wrong.

/home/paul/Documents/typochecker contains a sample file typo_ridden_text.txt with some typos as a check (it would be useful to users to provide an example?)
I clearly need a dictionary, but only for python 3.7 which is odd.
(Aside I note that the word significand is still not included - I feel strongly that it should be as it is in widespread use in the sort of docs that this is likely to be used for (even if the dictionaries have yet to catch up - see https://en.wikipedia.org/wiki/Talk%3ASignificand for discussion and https://en.wikipedia.org/wiki/Significand. I think the Wikipedia list of typos needs editing and I might get around to nogotiating with Wikipedia editors to this).

paul@hetp8:~/typochecker$ python -m typochecker.corrector --dir /home/paul/Documents/typochecker
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/paul/typochecker/typochecker/corrector.py", line 7, in
from typochecker.utils import parse_typos_file, get_visible_subdirs
File "typochecker/utils.py", line 106
typos = {**typos, **extra_typos}
^
SyntaxError: invalid syntax

and repeated with python3.7

paul@hetp8:/typochecker$ python3.7 -m typochecker.corrector --dir /home/paul/Documents/typochecker
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/paul/typochecker/typochecker/corrector.py", line 7, in
from typochecker.utils import parse_typos_file, get_visible_subdirs
File "/home/paul/typochecker/typochecker/utils.py", line 11, in
WORDS = Counter(wordify(open('/usr/share/dict/american-english-huge').read()))
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/dict/american-english-huge'
paul@hetp8:
/typochecker$

Suggestions on what I am doing wrong?

@pabristow , addressing (roughly) in order...

Windows: let me see if I can find a Windows machine to try on my side.

Python2: the syntax used in the code is, I believe, Python3-only.

Python3: I unintentionally put an unstated dependency in the code (to be addressed in #47). Your system is missing the dictionary that is used by the corpus builder. As a temporary workaround on your Ubuntu system, you could install it via sudo apt-get install wamerican-huge wbritish-huge.

"significand": I will consider removing it; I am presently inclined in that direction. At this point, an instance of "significand" that should be "significant" in a non-technical text would probably get picked out by the corpus builder.

sudo apt-get install wamerican-huge wbritish-huge allows this to work as expected with python3.7.

Requirement for 3.7 is worth documenting.

On Windows I think that I only have Python 3.7 but I will check that this is so.

I'm now exploring actually using it. Thanks.

On my Windows 10
PS H:\git-sandbox> python --version
Python 3.7.0
PS H:\git-sandbox> python2.7 --version
python2.7 : The term 'python2.7' is not recognized as the name of a cmdlet, function, script file, or operable program.

But it could be 'operator error'.

A sample 'dodgy_typos' file would help avoid this?

#48 removes "signifcand" from list of typos, and adds some documentation on the dictionary dependencies (see README.md).

Closed as confirmed that typochecker does not yet work on Windows 10 ( but only on *nix systems).