Skip to main content

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

Hose docs on github pages

cp -rf apidocs/build/html/* docs/

Build

  • Change version in pyproject.toml and sencore/__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

git tag [x.x.x]
git push origin master

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

sencore-0.1.21.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

sencore-0.1.21-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file sencore-0.1.21.tar.gz.

File metadata

  • Download URL: sencore-0.1.21.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.2 Linux/5.8.0-1036-azure

File hashes

Hashes for sencore-0.1.21.tar.gz
Algorithm Hash digest
SHA256 3be13c232d242620fd428c75b7a6a566005412afc5c7763418b0e3568c311257
MD5 4f471d08d2d062fae45138385d0028b5
BLAKE2b-256 7a385d9a637e6be0bc212e07cb6aa5e8ddae0b439b31e41a871658d0bdbe83bc

See more details on using hashes here.

File details

Details for the file sencore-0.1.21-py3-none-any.whl.

File metadata

  • Download URL: sencore-0.1.21-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.2 Linux/5.8.0-1036-azure

File hashes

Hashes for sencore-0.1.21-py3-none-any.whl
Algorithm Hash digest
SHA256 f99e7ba46156c410823733ab8294b237a890c27c8d34ed89f82e3735ab3e8531
MD5 ae27c80f32a00364fcdcbc57afc8bba1
BLAKE2b-256 166c3cefed8d6a507f5b68104c3220c81d2548824b11d38cfc9ceeeaeb197c0d

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