Skip to content

Commit 51678a7

Browse files
committed
Initial natlang setup
0 parents  commit 51678a7

File tree

8 files changed

+1742
-0
lines changed

8 files changed

+1742
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*~
2+
/.python-version
3+
/pymathics_natlang.egg-info
4+
__pycache__

Makefile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# A GNU Makefile to run various tasks - compatibility for us old-timers.
2+
3+
# Note: This makefile include remake-style target comments.
4+
# These comments before the targets start with #:
5+
# remake --tasks to shows the targets and the comments
6+
7+
GIT2CL ?= admin-tools/git2cl
8+
PYTHON ?= python3
9+
PIP ?= pip3
10+
RM ?= rm
11+
LANG ?= en
12+
13+
.PHONY: all build \
14+
check clean \
15+
develop dist doc doc-data \
16+
pytest \
17+
rmChangeLog \
18+
test
19+
20+
#: Default target - same as "develop"
21+
all: develop
22+
23+
#
24+
wordlist:
25+
$(PYTHON) -m nltk.downloader wordnet omw
26+
$(PYTHON) -m spacy download $(LANG)
27+
28+
#: build everything needed to install
29+
build:
30+
$(PYTHON) ./setup.py build
31+
32+
#: Set up to run from the source tree
33+
develop:
34+
$(PIP) install -e .
35+
$(MAKE) wordlist
36+
37+
#: Install mathics
38+
install:
39+
$(PYTHON) setup.py install
40+
41+
check: pytest doctest djangotest gstest
42+
43+
#: Remove derived files
44+
clean: clean-pyc
45+
46+
#: Remove old PYC files
47+
clean-pyc:
48+
@find . -name "*.pyc" -type f -delete
49+
50+
#: Run py.test tests. Use environment variable "o" for pytest options
51+
pytest:
52+
py.test test $o
53+
54+
55+
# #: Create data that is used to in Django docs and to build TeX PDF
56+
# doc-data mathics/doc/tex/data: mathics/builtin/*.py mathics/doc/documentation/*.mdoc mathics/doc/documentation/images/*
57+
# $(PYTHON) mathics/test.py -ot -k
58+
59+
#: Run tests that appear in docstring in the code.
60+
doctest:
61+
$(PYTHON) mathics/test.py $o
62+
63+
# #: Make Mathics PDF manual
64+
# doc mathics.pdf: mathics/doc/tex/data
65+
# (cd mathics/doc/tex && $(MAKE) mathics.pdf)
66+
67+
#: Remove ChangeLog
68+
rmChangeLog:
69+
$(RM) ChangeLog || true
70+
71+
#: Create a ChangeLog from git via git log and git2cl
72+
ChangeLog: rmChangeLog
73+
git log --pretty --numstat --summary | $(GIT2CL) >$@

README.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Natural Language Tookkit module.
2+
3+
To use this module, you will need to install nltk and spacy,
4+
Python modules and then install some data from English words:
5+
6+
::
7+
8+
$ make develop
9+
10+
If you would like to install works for another language set the
11+
variable ``LANG``. For example:
12+
13+
::
14+
15+
$ make develop LANG=fr
16+
17+
In order to use the Extended Open Multilingual Wordnet with NLTK and
18+
use even more languages, you need to install them manually. Go to
19+
`<http://compling.hss.ntu.edu.sg/omw/summx.html>`_, download the data,
20+
and then create a new folder under
21+
``$HOME/nltk_data/corpora/omw/your_language`` where you put the file
22+
from wiki/wn-wikt-your_language.tab, and rename it to
23+
wn-data-your_language.tab.

pymathics/__init__.py

Whitespace-only changes.

pymathics/natlang/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
Pymathics Natlang
3+
4+
This module provides tools to work with expressions in natural language, using the libraries ``nltk`` and ``spacy``.
5+
"""
6+
7+
8+
from pymathics.natlang.__main__ import *
9+
from pymathics.natlang.version import __version__
10+
11+
pymathics_version_data = {
12+
"author": "The Mathics Team",
13+
"version": __version__,
14+
"name": "Natlang",
15+
"requires": ["nltk", "spacy"],
16+
}

0 commit comments

Comments
 (0)