Skip to main content

Mathics3 Natural Language Toolkit module

Reason this release was yanked:

Packaging is still wrong

Project description

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}
In[5] = Synonyms["forget"]
Out[5]= {blank out, block, bury, draw a blank, leave}
In[6] = Antonyms["big"]
Out[6]= {little, small}
In[7] = LanguageIdentify["eins zwei drei"]
Out[7]= "German"

Other examples can be found in the test file.

Installing and Running

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

$ make develop  # or make install

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

$ make develop LANG=fr

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 library for advanced Natural Language Processing in Python.

You might be able to fix this by running:

python -m spacy download en

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

User customization

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:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mathics3_module_nltk-9.0.1.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mathics3_module_nltk-9.0.1-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file mathics3_module_nltk-9.0.1.tar.gz.

File metadata

  • Download URL: mathics3_module_nltk-9.0.1.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mathics3_module_nltk-9.0.1.tar.gz
Algorithm Hash digest
SHA256 a615a231d647c6a54b6013f2eab1b79b4c235d093413baf79458877437556b36
MD5 bea6675f4f94146ebf923d922023c71f
BLAKE2b-256 bf32fe587ee7db2cf26ad01e177f0c52be80f4aa17da977feb13b0fbed1d55d5

See more details on using hashes here.

File details

Details for the file mathics3_module_nltk-9.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mathics3_module_nltk-9.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bec76d074bb92f0cb8eceb0ba5ddf34ff80323e5d0d22dec607a528c47496957
MD5 d4ad508327aee9536207860c19914793
BLAKE2b-256 2701efb1f382798b42da18799740834e1e9709d375085527b1bde618e892bbac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page