Skip to content

Commit 844a8d2

Browse files
committed
Adjust for Mathics 5.0.0
1 parent d23cc01 commit 844a8d2

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

pymathics/natlang/__main__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@
4545
from mathics.builtin.numbers.randomnumbers import RandomEnv
4646
from mathics.builtin.codetables import iso639_3
4747
from mathics.builtin.strings import to_regex, anchor_pattern
48+
from mathics.core.atoms import Integer, String, Real
4849
from mathics.core.expression import (
4950
Expression,
50-
String,
51-
Integer,
52-
Real,
5351
Symbol,
5452
strip_context,
5553
string_list,
5654
)
55+
from mathics.core.listg import to_list_expression
56+
from mathics.core.symbols import SymbolDivide
57+
from mathics.core.systemsymbols import SymbolN
5758

5859
import os
5960
import re
@@ -493,7 +494,7 @@ def apply(self, text, word, evaluation, options):
493494
text = text.lower()
494495
if text in words:
495496
n += 1
496-
return Expression("N", Expression("Divide", n, len(doc)))
497+
return Expression(SymbolN, Expression(SymbolDivide, Integer(n), Integer(len(doc))))
497498

498499

499500
class Containing(Builtin):
@@ -583,7 +584,7 @@ def apply(self, text, form, evaluation, options):
583584
"TextCases[text_String, form_, OptionsPattern[%(name)s]]"
584585
doc = self._nlp(text.get_string_value(), evaluation, options)
585586
if doc:
586-
return Expression("List", *[t.text for t in _cases(doc, form)])
587+
return to_list_expression(*[t.text for t in _cases(doc, form)])
587588

588589
def apply_n(self, text, form, n, evaluation, options):
589590
"TextCases[text_String, form_, n_Integer, OptionsPattern[%(name)s]]"

setup.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
print("Mathics support Python 3.6 and above; you have %d.%d" % sys.version_info[:2])
1313
sys.exit(-1)
1414

15+
1516
def get_srcdir():
1617
filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
1718
return osp.realpath(filename)
@@ -20,6 +21,7 @@ def get_srcdir():
2021
def read(*rnames):
2122
return open(osp.join(get_srcdir(), *rnames)).read()
2223

24+
2325
# Get/set VERSION and long_description from files
2426
long_description = read("README.rst") + "\n"
2527

@@ -44,10 +46,17 @@ def read(*rnames):
4446
name="pymathics-natlang",
4547
version=__version__,
4648
packages=find_namespace_packages(include=["pymathics.*"]),
47-
install_requires=["Mathics3>=2.2.0", "nltk>=3.6.1", "spacy>=3.4",
48-
"llvmlite>=0.36", "joblib>=1.0.1",
49-
"click>=7.1", "six>=1.11.0",
50-
"pattern>=3.6.0", "wasabi<1.1.0,>=0.8.2"],
49+
install_requires=[
50+
"Mathics3 >= 5.0.0.dev0,<5.0.1",
51+
"click>=7.1",
52+
"joblib>=1.0.1",
53+
"llvmlite>=0.36",
54+
"nltk>=3.6.1",
55+
"pattern>=3.6.0",
56+
"six>=1.11.0",
57+
"spacy>=3.4",
58+
"wasabi<1.1.0,>=0.8.2",
59+
],
5160
zip_safe=False,
5261
maintainer="Mathics Group",
5362
long_description=long_description,

0 commit comments

Comments
 (0)