Skip to content

Commit 34c3004

Browse files
committed
Update README.rst, remove a deprecation warning
1 parent f03de68 commit 34c3004

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

CHANGES.rst

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

77
Re-Release to use released Mathics 1.1.0
88

9+
* tests added.
10+
* README.rst has been updated with examples.
11+
912
1.0.0
1013
-----
1114

README.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22

33
Mathics Natural Language Toolkit module.
44

5+
6+
Example Session
7+
---------------
8+
9+
::
10+
11+
$ mathicsscript
12+
In[1]:= LoadModule["pymathics.natlang"]
13+
Out[1]= pymathics.natlang
14+
In[2]= Pluralize["try"]
15+
Out[2]= tries
16+
In[3]= WordFrequency["Apple Tree and apple", "apple", IgnoreCase -> True]
17+
Out[3]= 0.5
18+
In[4] = TextCases["I was in London last year.", "Pronoun"]
19+
Out[3]= {I}
20+
21+
More examples can be found in the `test file <https://github.com/Mathics3/pymathics-natlang/blob/master/test/test_natlang.py>`_.
22+
23+
Installing and Running
24+
----------------------
25+
526
To use build module, you will need to install Python module `nltk
627
<https://pypi.org/project/nltk/>`_ and `spacy
728
<https://pypi.org/project/spacy/>`_, and then install some data from
@@ -47,3 +68,5 @@ Adjust "python" and "en" (the language you want) above as needed.
4768
:target: https://badge.fury.io/py/pymathics-natlang
4869
.. |Pypi Installs| image:: https://pepy.tech/badge/pymathics-natlang
4970
.. |Supported Python Versions| image:: https://img.shields.io/pypi/pyversions/pymathics-natlang.svg
71+
.. |Packaging status| image:: https://repology.org/badge/vertical-allrepos/pymathics-natlang.svg
72+
:target: https://repology.org/project/pymathics-natlang/versions

pymathics/natlang/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565

6666
def _parse_nltk_lookup_error(e):
67-
m = re.search("Resource '([^']+)' not found\.", str(e))
67+
m = re.search(r"Resource '([^']+)' not found\.", str(e))
6868
if m:
6969
return m.group(1)
7070
else:

setup.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@
44
import sys
55
import platform
66
import os
7+
import os.path as osp
78
from setuptools import setup, find_namespace_packages
89

910
# Ensure user has the correct Python version
1011
if sys.version_info < (3, 6):
1112
print("Mathics support Python 3.6 and above; you have %d.%d" % sys.version_info[:2])
1213
sys.exit(-1)
1314

15+
def get_srcdir():
16+
filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
17+
return osp.realpath(filename)
18+
19+
20+
def read(*rnames):
21+
return open(osp.join(get_srcdir(), *rnames)).read()
22+
23+
# Get/set VERSION and long_description from files
24+
long_description = read("README.rst") + "\n"
25+
1426
# stores __version__ in the current namespace
1527
exec(compile(open("pymathics/natlang/version.py").read(), "version.py", "exec"))
1628

@@ -33,9 +45,9 @@
3345
version=__version__,
3446
packages=find_namespace_packages(include=["pymathics.*"]),
3547
install_requires=["Mathics3>=1.1.0", "nltk", "spacy<3.0", "pattern"],
36-
# don't pack Mathics in egg because of media files, etc.
3748
zip_safe=False,
3849
maintainer="Mathics Group",
50+
long_description=long_description,
3951
long_description_content_type="text/x-rst",
4052
# metadata for upload to PyPI
4153
classifiers=[

0 commit comments

Comments
 (0)