Skip to content

Commit

Permalink
Fix error when querying words with slashes
Browse files Browse the repository at this point in the history
This should fix #7
I'm not sure yet if this is the sole cause of #3
  • Loading branch information
abdnh committed Oct 5, 2022
1 parent 504e64a commit fe09c4b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ isort==5.10.1
ankibuild
git+https://github.com/abdnh/ankibuild@5092188f6b7c73e7bab2c7f64e7008a7e24466f6#egg=ankibuild[qt5,qt6]
zimply-core
git+https://github.com/abdnh/zimply-core@f682cedd8c774da2c492203e2ab75f6b7228a92c
git+https://github.com/abdnh/zimply-core@09c6f0f004591e0642590210248e87ff72bb6e21
spacy==3.4.1
2 changes: 1 addition & 1 deletion scripts/vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ while getopts ":s" option; do
;;
esac
done
pip install -U --no-deps git+https://github.com/abdnh/zimply-core@f682cedd8c774da2c492203e2ab75f6b7228a92c -t src/vendor
pip install -U --no-deps git+https://github.com/abdnh/zimply-core@09c6f0f004591e0642590210248e87ff72bb6e21 -t src/vendor
./scripts/setup_pyzstd.sh
if [ "$spacy" = true ]; then
pip install spacy==3.4.1 -t src/vendor
Expand Down
4 changes: 2 additions & 2 deletions src/dictionaries/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def _get_article(query: str, dictionary: ZIMDict) -> Article | None:
forms = [query, query.lower(), query.title(), query.upper()]
for form in forms:
try:
article = dictionary.zim_client.get_article(form)
article = dictionary.zim_client.get_article_by_title(form)
return article
except KeyError:
pass
# Return first search result, if any
results = dictionary.zim_client.search(query, 0, 1)
if results:
return dictionary.zim_client.get_article(results[0].url)
return dictionary.zim_client.get_article_by_title(results[0].url)
return None

def get_article(self, query: str, dictionary: ZIMDict) -> Article | None:
Expand Down

0 comments on commit fe09c4b

Please sign in to comment.