Cross-platform ENIAM with useful bindings 🚀
This project provides only a wrapper for ENIAM (see online source code) Author of original code is Wojciech Jaworski.
Using eniam library
- First, you have to install eniam by calling
pip install eniam - Then you can try parsing some example phrases (see
examples/example.ipynb):
# !pip install opencv-python
# !pip install camelot-py
# !pip install wand
from eniam import *
dom_result = Eniam(['KOT', 'MYSZ'], {
rule(lemma='kot',pos=subst,case=nom): gram('KOT'),
rule(lemma='gonić',pos=fin,person=ter): (ip<gram('KOT'))>gram('MYSZ'),
rule(lemma='mysz',pos=subst,case=acc): gram('MYSZ'),
root_rule(): s % ip,
}, ['KOT', 'MYSZ', 'ZDARZENIE'], {
valence_rule('kot', 'noun'): 'KOT',
valence_rule('mysz', 'noun'): 'MYSZ',
valence_rule('gonić', 'verb'): 'ZDARZENIE',
}).dom("Kot goni mysz.")
dom_result.show()
Eniam syntax
The eniam library uses custom primitive AST the most of the operations looks exactly the same as in normal ENIAM convensions except for those modifications:
/is replaced with>\is replaced with<ip{ |x1, |x2, |x3... |xn}is replaced withip[ x1 | x2 | ... | xn]?xis replaced with functionoptional(x)a\?(x)is replaced witha % x- the grammar can contain inline literals created using
gram()function for examplerule(lemma='kot',pos=subst): gram('np/np\\np'),would be a valid rule.
Useful methods
- Showing the result in Jupyter notebook
Eniam(...).dom("Kot goni mysz.").show() - Getting the html code
Eniam(...).dom("Kot goni mysz.").html() - Saving the html code
Eniam(...).dom("Kot goni mysz.").save_html('output_file') - Multiple input sentences
- Showing the result in Jupyter notebook
Eniam(...).dom(["Kot goni mysz.", "Mysz goni kota."]).show()
Using raw ENIAM interface
Running inside docker
To run ENIAM docker please use the following commands:
# Run subsyntax tool
$ docker run -it styczynski/eniam:1.0 /root/subsyntax --help
# Run lexicon printer
$ docker run -it styczynski/eniam:1.0 /root/print_lexicon --help
# Run DOM parser
$ docker run -it styczynski/eniam:1.0 /root/domparser --help
Running with Python wrapper
You can install Python wrapper to get a nice wrapper around the docker container (this requires Python +3 and Docker installed):
$ pip install eniam
$ eniam-cli sub --help
$ eniam-cli lex --help
$ eniam-cli dom --help
Note: Before installing you may wish to add python /bin/ directory to the PATH variable. On MacOS for Python 3.7 that would be:
$ export PATH="$PATH:/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin"
Metadata
Release files for eniam 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eniam-1.0.tar.gz | 96.1 kB | Without provenance | Details for eniam-1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eniam-1.0-py3-none-any.whl | Python 3 | none | any | Details for eniam-1.0-py3-none-any.whl |
Total release size: 307.6 kB
Release files / eniam-1.0.tar.gz
| Download URL | eniam-1.0.tar.gz |
|---|---|
| Size | 96.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b76640c0c9fe19198e0633f4beb8c16cdf35b6148b539e028b3ce0f27a7cde5
|
|
BLAKE2b-256 checksum How to use checksums |
8cb8766dcf47eb0f8bfb9c390d196e73745794e82a462f5d557d94e027648a40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5
|
Release files / eniam-1.0-py3-none-any.whl
| Download URL | eniam-1.0-py3-none-any.whl |
|---|---|
| Size | 211.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f54ab07194f3844292a156f4c4d5f7d83699b3d3a948a90c9875c9a773f4f5bf
|
|
BLAKE2b-256 checksum How to use checksums |
c77244612140ace533edeb646b89c303db2ce494d3ef57e316ff5ad48a80e20d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5
|
Security for eniam 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.