Skip to main content

Pypi Installs Latest Version Supported Python Versions

Mathics3 Natural Language Toolkit module.

Example Session

$ mathicsscript
In[1]:= LoadModule["pymathics.natlang"]
Out[1]= pymathics.natlang
In[2]= Pluralize["try"]
Out[2]= tries
In[3]= WordFrequency["Apple Tree and apple", "apple", IgnoreCase -> True]
Out[3]= 0.5
In[4] = TextCases["I was in London last year.", "Pronoun"]
Out[4]= {I}

More examples can be found in the test file.

Installing and Running

To use build module, you will need to install Python module nltk and spacy, and then install some data from Language-specific words:

$ make develop  # or make install

The above make command uses defaults the language to English. If you would like to install for another language set the variable LANG. For example:

$ make develop LANG=fr

In order to use the Extended Open Multilingual Wordnet with NLTK and use even more languages, you need to install them manually. Go to http://compling.hss.ntu.edu.sg/omw/summx.html, download the data, and then create a new folder under $HOME/nltk_data/corpora/omw/your_language where you put the file from wiki/wn-wikt-your_language.tab, and rename it to wn-data-your_language.tab.

If you get the message

OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

There is a problem with the spacy the library for advanced Natural Language Processing in Python.

You might be able to fix this running:

python -m spacy download en

Adjust “python” and “en” (the language you want) above as needed.

User customization

In order to use the Extended Open Multilingual Wordnet (OMW) with ‘NLTK’ and use even more languages, you need to install them manually.

Go to http://compling.hss.ntu.edu.sg/omw/summx.html, download the data, and then create a new folder under $HOME/nltk_data/corpora/omw/your_language where you put the file from wiki/wn-wikt-your_language.tab, and rename it to wn-data-your_language.tab.

Adding more languages to Open Multilingual Wordnet:

In order to use the Extended Open Multilingual Wordnet with NLTK and use even more languages, you need to install them manually. Go to http://compling.hss.ntu.edu.sg/omw/summx.html, download the data, and then create a new folder under $HOME/nltk_data/corpora/omw/your_language where you put the file from wiki/wn-wikt-your_language.tab, and rename it to wn-data-your_language.tab.

Release files for pymathics-natlang 8.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymathics-natlang 8.0.1
File Size Uploaded
pymathics_natlang-8.0.1.tar.gz 41.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymathics-natlang 8.0.1
File Interpreter ABI Platform
pymathics_natlang-8.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 75.2 kB

Release files / pymathics_natlang-8.0.1.tar.gz

Download URL pymathics_natlang-8.0.1.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d31da297592a10dae07529b891cad01e32ccd11d0c144c6e9f8675e61d082a23
BLAKE2b-256 checksum
How to use checksums
e8a3d60ef3d51218eb77ab4696392b1c765ebd6e147851aeea39055bb64a65df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / pymathics_natlang-8.0.1-py3-none-any.whl

Download URL pymathics_natlang-8.0.1-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ae2a2781c234eea9fb89270ca7e968094b6559ddecbfc86359bcc965d486441
BLAKE2b-256 checksum
How to use checksums
2114758adfa8520cef6d1bb7d315780e829468266eac8289bbcad13f29fe9087
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release history Release notifications | RSS feed

This release

8.0.1 This release

2 release files

8.0.0

2 release files

7.0.0

2 release files

6.0.0

8 release files

5.0.0

8 release files

2.2.0

7 release files

1.1.0

6 release files

1.0.0

7 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page