Skip to content

Commit 54bb94c

Browse files
committed
Adjust for medium word list
The small wordlist doesn't have word vectors and that gives a warning with Similarity is used. So instead use the medium word list.
1 parent 1c53e8f commit 54bb94c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pymathics/natlang/__main__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def _load_spacy(self, evaluation, options):
256256
if "SPACY_DATA" in os.environ:
257257
instance = spacy.load(language_code, via=os.environ["SPACY_DATA"])
258258
else:
259-
instance = spacy.load(f"{language_code}_core_web_sm")
259+
instance = spacy.load(f"{language_code}_core_web_md")
260260

261261
_SpacyBuiltin._spacy_instances[language_code] = instance
262262
return instance
@@ -567,7 +567,7 @@ class TextCases(_SpacyBuiltin):
567567
= {London}
568568
569569
>> TextCases[Import["ExampleData/EinsteinSzilLetter.txt"], "Person", 3][[2;;3]]
570-
= {E. Fermi, L. Szilard}
570+
= {L. Szilard, Joliot}
571571
"""
572572

573573
def apply_string_form(self, text, form, evaluation, options):
@@ -683,13 +683,13 @@ class WordSimilarity(_SpacyBuiltin):
683683
</dl>
684684
685685
>> NumberForm[WordSimilarity["car", "train"], 3]
686-
= 0.731
686+
= 0.439
687687
688688
>> NumberForm[WordSimilarity["car", "hedgehog"], 3]
689-
= 0.302
689+
= 0.195
690690
691691
>> NumberForm[WordSimilarity[{"An ocean full of water.", {2, 2}}, { "A desert full of sand.", {2, 5}}], 3]
692-
= {0.731, 0.317}
692+
= {0.505, 0.481}
693693
"""
694694

695695
messages = _merge_dictionaries(

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def read(*rnames):
2525
# Get/set VERSION and long_description from files
2626
long_description = read("README.rst") + "\n"
2727

28+
__version__ = "0.0.0" # overwritten by exec below
29+
2830
# stores __version__ in the current namespace
2931
exec(compile(open("pymathics/natlang/version.py").read(), "version.py", "exec"))
3032

@@ -34,7 +36,7 @@ def read(*rnames):
3436
# Environment variables "lang", "WORDLIST_SIZE", and "SPACY_DOWNLOAD" override defaults.
3537

3638
# Full package name with two-letter language code, e.g. fr, zh
37-
lang = os.environ.get("lang", "en_core_web_sm")
39+
lang = os.environ.get("lang", "en_core_web_md")
3840

3941
# Size of wordlist used
4042
# sm=small, lg=large, md=medium.

0 commit comments

Comments
 (0)