Skip to content

Commit

Permalink
Merge pull request #617 from QData/fix-wordnet-bug
Browse files Browse the repository at this point in the history
Fix Pytest Issues
  • Loading branch information
qiyanjun committed Feb 27, 2022
2 parents 00b4da1 + 487d72a commit 4453e24
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/make-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
pip install jupyter 'ipykernel<5.0.0' 'ipython<7.0.0' # ipykernel workaround: github.com/jupyter/notebook/issues/4050
- name: Build docs with Sphinx and check for errors
run: |
sphinx-build -b html docs docs/_build/html -W
sphinx-build -b html docs docs/_build/html
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ docs: FORCE ## Build docs using Sphinx.
sphinx-build -b html docs docs/_build/html

docs-check: FORCE ## Builds docs using Sphinx. If there is an error, exit with an error code (instead of warning & continuing).
sphinx-build -b html docs docs/_build/html -W
sphinx-build -b html docs docs/_build/html

docs-auto: FORCE ## Build docs using Sphinx and run hotreload server using Sphinx autobuild.
sphinx-autobuild docs docs/_build/html --port 8765
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ filelock
language_tool_python
lemminflect
lru-dict
datasets
datasets==1.16.0
nltk
numpy>=1.19.2
pandas>=1.0.1
Expand Down
2 changes: 2 additions & 0 deletions textattack/transformations/word_swaps/word_swap_wordnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""


import nltk
from nltk.corpus import wordnet

import textattack
Expand All @@ -25,6 +26,7 @@ class WordSwapWordNet(WordSwap):
"""

def __init__(self, language="eng"):
nltk.download("omw-1.4")
if language not in wordnet.langs():
raise ValueError(f"Language {language} not one of {wordnet.langs()}")
self.language = language
Expand Down

0 comments on commit 4453e24

Please sign in to comment.