sentence nlp parser for multilingua
Project description
Installation
Install from pip3
pip3 install --verbose sencore
Install spacy lib
python -m spacy download en_core_web_trf
python -m spacy download es_dep_news_trf
Usage
Please refer to api docs.
Executable usage
-
Parse sentence into vocabs
parse2vocab --lang en --sentence "It is a great day." -
Parse sentence into phrases
parse2phrase --lang en --sentence "It is a great day."
Package usage
-
Parse sentence into vocabs
from sencore import VocabParser def vocab(lang, sentence): sentences = { "en": "Apple is looking at buying U.K. startup for $1 billion.", "es": "En 1941, fue llamado a filas para incorporarse a la Armada.", "de": "Für Joachim Löw ist ein Nationalmannschafts-Comeback von Thomas Müller und Mats Hummels nicht mehr kategorisch ausgeschlossen.", "fr": "Nos jolis canards vont-ils détrôner les poules, coqueluches des jardiniers ?", } sen = sentence or sentences[lang] print(sen) vp = VocabParser(lang) vocabs = vp.digest(sen) print(vocabs) -
Parse sentence into phrases
from sencore import PhraseParser def phrase(lang, sentence): sentences = { "en": "Apple is looking at buying U.K. startup for $1 billion.", "es": "En 1941, fue llamado a filas para incorporarse a la Armada.", "de": "Für Joachim Löw ist ein Nationalmannschafts-Comeback von Thomas Müller und Mats Hummels nicht mehr kategorisch ausgeschlossen.", "fr": "Nos jolis canards vont-ils détrôner les poules, coqueluches des jardiniers ?", } sen = sentence or sentences[lang] print(sen) pp = PhraseParser(lang) phrases = pp.digest(sen) print(phrases)
Development
Clone project
git clone https://github.com/qishe-nlp/sencore.git
Install poetry
Install dependencies
poetry update
python -m spacy download en_core_web_trf
python -m spacy download es_dep_news_trf
Test
poetry run pytest -rP
which run tests under tests/*
Execute
poetry run parse_to_vocab --help
Create sphinx docs
poetry shell
cd apidocs
sphinx-apidoc -f -o source ../sencore
make html
python -m http.server -d build/html
Host docs on github pages
cp -rf apidocs/build/html/* docs/
Build
- Change
versioninpyproject.tomlandsencore/__init__.py - Build python package by
poetry build
Git commit and push
Publish from local dev env
- Set pypi test environment variables in poetry, refer to poetry doc
- Publish to pypi test by
poetry publish -r test
Publish through CI
- Github action build and publish package to test pypi repo
git tag [x.x.x]
git push origin master
- Manually publish to pypi repo through github action
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sencore-0.1.56.tar.gz
(9.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sencore-0.1.56-py3-none-any.whl
(15.1 kB
view details)
File details
Details for the file sencore-0.1.56.tar.gz.
File metadata
- Download URL: sencore-0.1.56.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.0 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94995e50f35cb53dfdea6d37e4e93239144af6e3f45c922ef9e2fa181bf68639
|
|
| MD5 |
bdbc6b55fd56ed2f45221fa745c56987
|
|
| BLAKE2b-256 |
7d095cefb348e93612276b0167e37a4cddafd53153a7ea7eae790a241f31e1a2
|
File details
Details for the file sencore-0.1.56-py3-none-any.whl.
File metadata
- Download URL: sencore-0.1.56-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.0 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb67f6cbf82fe40e06b724d6b4c53144eb95dfa288180da2745e2c566745bbf4
|
|
| MD5 |
b70b1b1ca970e231a0bb513d65e07b83
|
|
| BLAKE2b-256 |
ef84f9c7d4b6574ce579b18181427005fbeeabf78dedce67de4054291f9e4735
|