Skip to content

Commit 4efc012

Browse files
committed
Use PatternLite instead of defunkt pattern...
It looks like we get a loss in qualiity too
1 parent 7ff91b7 commit 4efc012

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

pymathics/natlang/nltk.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from itertools import chain
88

99
import nltk
10+
from pattern.en import lexeme, pluralize
11+
1012
from mathics.builtin.codetables import iso639_3
1113
from mathics.core.atoms import String
1214
from mathics.core.builtin import Builtin, MessageException
@@ -304,12 +306,9 @@ def inflected_forms(self, syn, desc):
304306
try:
305307
word, pos, _ = desc
306308
if pos == "Verb":
307-
from pattern.en import lexeme
308309

309310
return [w for w in reversed(lexeme(word)) if w != word]
310311
elif pos == "Noun":
311-
from pattern.en import pluralize
312-
313312
return [pluralize(word)]
314313
elif pos == "Adjective":
315314
from pattern.en import comparative, superlative

pymathics/natlang/normalization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class TextCases(_SpacyBuiltin):
101101
## >> TextCases[Import["ExampleData/EinsteinSzilLetter.txt"], "Person", 3][[2;;3]]
102102
## = {L. Szilard, Joliot}
103103
104-
>> TextCases["Anne, Peter and Mr Johnes say hello.", "Person", 3][[2;;3]]
104+
>> TextCases["Saul, Peter and Mr Johnes say hello.", "Person", 3][[2;;3]]
105105
= {Peter, Johnes}
106106
107107
"""

pymathics/natlang/textual_analysis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,13 @@ class WordSimilarity(_SpacyBuiltin):
217217
</dl>
218218
219219
>> NumberForm[WordSimilarity["car", "train"], 3]
220-
= 0.439
220+
= 0.169
221221
222222
>> NumberForm[WordSimilarity["car", "hedgehog"], 3]
223-
= 0.195
223+
= 0.0173
224224
225225
>> NumberForm[WordSimilarity[{"An ocean full of water.", {2, 2}}, { "A desert full of sand.", {2, 5}}], 3]
226-
= {0.505, 0.481}
226+
= {0.127, 0.256}
227227
"""
228228

229229
messages = merge_dictionaries(

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def read(*rnames):
5959
"langid", # replace with a supported newer package, e.g. via spacy
6060
"llvmlite>=0.36",
6161
"nltk>=3.8.0",
62-
"pattern",
62+
"PatternLite",
6363
"pyenchant>=3.2.0",
6464
"pycountry>=3.2.0",
6565
"spacy>=3.4",
@@ -76,11 +76,11 @@ def read(*rnames):
7676
"Intended Audience :: Science/Research",
7777
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
7878
"Programming Language :: Python",
79-
"Programming Language :: Python :: 3.7",
8079
"Programming Language :: Python :: 3.8",
8180
"Programming Language :: Python :: 3.9",
8281
"Programming Language :: Python :: 3.10",
8382
"Programming Language :: Python :: 3.11",
83+
"Programming Language :: Python :: 3.12",
8484
"Programming Language :: Python :: Implementation :: CPython",
8585
"Programming Language :: Python :: Implementation :: PyPy",
8686
"Topic :: Scientific/Engineering",

test/consistency-and-style/test_summary_text.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
import pytest
88

9+
from types import ModuleType
10+
from typing import Dict
11+
912
from mathics.core.load_builtin import name_is_builtin_symbol
1013
from mathics.core.builtin import Builtin
1114
from mathics.doc.gather import skip_doc

test/helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import time
22
from typing import Optional
33

4-
from mathics.session import MathicsSession, import_and_load_builtins
4+
from mathics.core.load_builtin import import_and_load_builtins
5+
from mathics.session import MathicsSession
56

67
import_and_load_builtins()
78

0 commit comments

Comments
 (0)