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

Download a custom Aspell dictionary and build it #1485

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ before_install:
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then retry pip install aspell-python-py2; fi
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "3" ]; then retry pip install aspell-python-py3; fi
- cd $SRC_DIR
- wget "http://app.aspell.net/create?max_size=95&spelling=US&spelling=GBs&spelling=GBz&spelling=CA&spelling=AU&max_variant=2&diacritic=both&special=hacker&special=roman-numerals&encoding=utf-8&format=inline&download=aspell" -O customdict.tar.bz2
- tar xjf customdict.tar.bz2
- cd aspell6-en-custom
- ./configure
- make
- cd $SRC_DIR

install:
- python setup.py install
Expand Down
2 changes: 1 addition & 1 deletion codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# The aspell tests here aren't the ideal state, but the None's are realistic
# for obscure words
('clear', 'for unambiguous errors', '', False, None),
('rare', 'for rare but valid words', '_rare', None, None),
('rare', 'for rare but valid words', '_rare', True, None),
('informal', 'for informal words', '_informal', True, True),
('code', 'for words common to code and/or mathematics', '_code', None, None), # noqa: E501
('names', 'for valid proper names that might be typos', '_names', None, None), # noqa: E501
Expand Down
1 change: 1 addition & 0 deletions codespell_lib/data/dictionary_rare.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ panting->painting
payed->paid
planed->planned
pleas->please
pneumonic->mnemonic, pneumonia,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess pneumatic is probably "too different"?

preform->perform
preformed->performed
preforms->performs
Expand Down
3 changes: 2 additions & 1 deletion codespell_lib/tests/test_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

try:
import aspell
speller = aspell.Speller('lang', 'en')
#speller = aspell.Speller('lang', 'en')
speller = aspell.Speller(('lang', 'en-custom'), ('data-dir', '/home/travis/build/codespell-project/codespell/aspell6-en-custom/'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably makes sense to tweak this to not rely on a hardcoded /home/travis/... path?

except Exception as exp: # probably ImportError, but maybe also language
speller = None
if os.getenv('REQUIRE_ASPELL', 'false').lower() == 'true':
Expand Down