Skip to content

Commit

Permalink
Use enabled senses and update spaCy 3.8.2
Browse files Browse the repository at this point in the history
also update test files because the new spaCy models
  • Loading branch information
xxyzz committed Oct 6, 2024
1 parent 3e54a5b commit 2a8d8bd
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 144 deletions.
7 changes: 3 additions & 4 deletions data/deps.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"lxml": "5.3.0",
"rapidfuzz": "3.10.0",
"spacy": "3.7.6",
"spacy_cpu_model": "3.7.0",
"en_spacy_cpu_model": "3.7.1",
"thinc-apple-ops": "0.1.5"
"spacy": "3.8.2",
"spacy_cpu_model": "3.8.0",
"thinc-apple-ops": "1.0.0"
}
6 changes: 2 additions & 4 deletions deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ def install_deps(pkg: str, notif: Any) -> None:
else:
# Install X-Ray dependencies
pip_install("rapidfuzz", dep_versions["rapidfuzz"], notif=notif)

if pkg == "":
pip_install("spacy", dep_versions["spacy"], notif=notif)
else:
pip_install("spacy", dep_versions["spacy"], notif=notif)
if pkg != "":
model_version = get_spacy_model_version(pkg, dep_versions)
url = (
"https://github.com/explosion/spacy-models/releases/download/"
Expand Down
6 changes: 3 additions & 3 deletions epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ def find_sense_ids_with_pos(
"""
SELECT DISTINCT s.id
FROM senses s JOIN lemmas l ON s.lemma_id = l.id
WHERE lemma = ? AND pos = ?
WHERE lemma = ? AND pos = ? AND enabled = 1
""",
(lemma, pos),
):
Expand All @@ -580,7 +580,7 @@ def find_sense_ids_without_pos(self, word: str) -> tuple[int, ...]:
"""
SELECT DISTINCT s.id
FROM senses s JOIN lemmas l ON s.lemma_id = l.id
WHERE lemma = ?
WHERE lemma = ? AND enabled = 1
""",
(word,),
):
Expand All @@ -591,7 +591,7 @@ def find_sense_ids_without_pos(self, word: str) -> tuple[int, ...]:
"""
SELECT DISTINCT s.id
FROM senses s JOIN forms f ON s.lemma_id = f.lemma_id AND s.pos = f.pos
WHERE form = ?
WHERE form = ? AND enabled = 1
""",
(word,),
):
Expand Down
2 changes: 1 addition & 1 deletion parse_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def get_kindle_lemma_with_pos(
"""
SELECT difficulty, senses.id
FROM senses JOIN lemmas ON senses.lemma_id = lemmas.id
WHERE lemma = ? AND pos = ? LIMIT 1
WHERE lemma = ? AND pos = ? AND enabled = 1 LIMIT 1
""",
(lemma, pos),
):
Expand Down
34 changes: 17 additions & 17 deletions tests/LanguageLayer.en.AZW3.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
[
1797,
5,
32801
32803
],
[
1866,
Expand All @@ -48,7 +48,7 @@
[
2113,
5,
11140
11141
],
[
2130,
Expand Down Expand Up @@ -93,12 +93,12 @@
[
2684,
2,
66918
66938
],
[
2712,
4,
17656
2700
],
[
2776,
Expand All @@ -108,12 +108,12 @@
[
3434,
5,
70600
75440
],
[
3443,
5,
36194
36195
],
[
3494,
Expand All @@ -133,12 +133,12 @@
[
3852,
5,
2366
35605
],
[
4229,
5,
47529
47532
],
[
4262,
Expand All @@ -148,17 +148,17 @@
[
4332,
5,
2366
35605
],
[
4957,
4,
17784
9243
],
[
4989,
5,
48552
48553
],
[
5034,
Expand All @@ -183,7 +183,7 @@
[
5292,
4,
60243
66676
],
[
5366,
Expand All @@ -193,22 +193,22 @@
[
5495,
5,
54321
54323
],
[
5563,
5,
40142
4,
78727
],
[
5578,
5,
22640
26331
],
[
5651,
4,
58060
58061
],
[
5671,
Expand Down
32 changes: 16 additions & 16 deletions tests/LanguageLayer.en.KFX.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
[
341,
5,
32801
32803
],
[
410,
Expand All @@ -48,7 +48,7 @@
[
657,
5,
11140
11141
],
[
674,
Expand Down Expand Up @@ -93,12 +93,12 @@
[
1018,
2,
66918
66938
],
[
1046,
4,
17656
2700
],
[
1110,
Expand All @@ -108,12 +108,12 @@
[
1213,
5,
70600
75440
],
[
1222,
5,
36194
36195
],
[
1273,
Expand All @@ -138,7 +138,7 @@
[
1634,
5,
47529
47532
],
[
1647,
Expand All @@ -148,17 +148,17 @@
[
1695,
5,
2366
35605
],
[
1735,
4,
17784
9243
],
[
1767,
5,
48552
48553
],
[
1775,
Expand All @@ -183,7 +183,7 @@
[
1922,
4,
60243
66676
],
[
1959,
Expand All @@ -193,22 +193,22 @@
[
2014,
5,
54321
54323
],
[
2045,
5,
40142
4,
78727
],
[
2060,
5,
22640
26331
],
[
2096,
4,
58060
58061
],
[
2116,
Expand Down
Loading

0 comments on commit 2a8d8bd

Please sign in to comment.