Does the neat typochecker work on Windows?
Closed this issue · 9 comments
As a Microsofty, I have tried this out from a cmd window, first assuming it would read from the file system and test a .qbk single file.
`Microsoft Windows [Version 10.0.18362.476]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\Paul>cd ./onedrive/documents
C:\Users\Paul\OneDrive\Documents>cd ./typochecker
C:\Users\Paul\OneDrive\Documents\typochecker>corrector.py
Getting list of typos
Information from https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
opening C:\Users\Paul\OneDrive\Documents\typochecker\data\wikipedia_common_misspellings.txt
Searching file: I:\boost\libs\multiprecision\doc\multiprecision.qbk
Suggestions follow for file I:\boost\libs\multiprecision\doc\multiprecision.qbk
I was overjoyed that there were no suggestions meaning that I had eradicated all the typos etc,
Microsoft Windows [Version 10.0.18362.476]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\Paul\OneDrive\Documents\typochecker>corrector.py
Getting list of typos Information from https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
opening C:\Users\Paul\OneDrive\Documents\typochecker\data\wikipedia_common_misspellings.txt
Searching file: I:\boost\libs\multiprecision\doc\multiprecision.qbk
Suggestions follow for file I:\boost\libs\multiprecision\doc\multiprecision.qbk
`
but disappointed when I introduced a known typo, but didn't get any suggestions :-(
So I RTFM and changed all_git_files_for_autocorrect.txt
to contain just I:\boost\libs\multiprecision\.git
committed the .qbk file with a known typo NOT acceptible
and I then got
C:\Users\Paul\OneDrive\Documents\typochecker>corrector.py
Getting list of typos Information from https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
opening C:\Users\Paul\OneDrive\Documents\typochecker\data\wikipedia_common_misspellings.txt
Searching file: I:\boost\libs\multiprecision.git
What am I misunderstanding/doing wrong? Or is my expectation that it will work on Windows wrong ? (is *nix only?)
@pabristow , I have only used/tested this with Linux.
This morning I removed the use of all_git_files_for_autocorrect.txt
; now (check the Makefile for exact invocation) it pipes the output of git ls-files
directly into the script. However, if you want to use the version you have already pulled, that file should contain the individual names of files to be scanned. For reference, here is the top of the file I see when I run this on multiprecision:
head -10 all_git_files_for_autocorrect.txt
.circleci/config.yml
.clang-format
.gitattributes
.travis.yml
README.md
appveyor.yml
config/Jamfile.v2
config/has_constexpr_limits_cmd.cpp
config/has_eigen.cpp
config/has_float128.cpp
If git ls-files | corrector.py
(or the Windows equivalent of |
ing) does not loop over all of the files, please let me know what you see.
@bwignall Thanks for this, but I think, for now at least, I will leave use of this to my *nixy colleagues for now. (I never make these mis-spellings anyway, and if they make them, this neat program will catch them. ;-) )
@pabristow , from your description, I thought this might be because of the Git CLI used, so I added an option that allows this to be a pure-Python tool: if you add -d YOUR_DIR
, this will search YOUR_DIR
directly, without using Git CLI. In your case, if you have a folder 'C:\boost\multiprecision', from this code's directory, running python corrector.py -d C:\boost\multiprecision
"should" give the expected behavior.
I added some brief description of this in the README.
Ah - bingo! You scored 4 'typos' :-(
`
C:\Users\Paul\OneDrive\Documents\typochecker>python corrector.py -d
I:\boost\libs\multiprecision\doc
Getting list of typos
Information from https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
opening data\wikipedia_common_misspellings.txt
file_typos: ['proceding', 'acceptible', 'upto', 'inbetween', 'inadvertant']
Suggestions follow for file I:\boost\libs\multiprecision\doc\multiprecision.qbk
file_typos: ['proceding', 'inadvertant']
Suggestions follow for file I:\boost\libs\multiprecision\doc\html\boost_multiprecision\map\hist.html
file_typos: ['procede']
Suggestions follow for file I:\boost\libs\multiprecision\doc\html\boost_multiprecision\tut\import_export.html
Importing or exporting cpp_bin_float is similar, but we must procede via
^^^^^^^^^^
Suggestion: proceed, precede
Correction ("!h" for help), default to proceed, precede:
`
which is really useful for finding spilling misfakes.
Many thanks
Paul
PS It gets messier in our Boost.Math and Multiprecision libraries because some typos are in Quickbook markup within C++ .*pp files, and if one searches the /doc subfolder then these only show up in the /html, html files - but that's entirely the 'fault' of the directory structure, not yours.
Great, happy to hear it.
If you run python corrector.py -d I:\boost\libs\multiprecision
(that is, the same command, but without the doc
) at the end, that should scan "multiprecision" and "multiprecision\doc" and recursively any other subdirectories of "multiprecision".
Shall we consider this issue resolved and close it?
Closing this because (based on the above) I believe the answer to the issue's question is "yes". If that is incorrect, please feel to re-open it.
#46 suggests that the answer in the issue's question is "no". Further investigation needed.
OK - thanks for confirmed that I am not just doing something silly (unknown, of course).
You have cleared at the typos until someone starts writing again when it would be neat to have it working on Windows, but not essential as some of the authors are *nix users.
Closed awaiting a possible enhancement to work on Windows.