Skip to main content

Extract phrase from English sentence such as noun, verb, preposition based on NLP task word chunking and HuggingFace library

Project description

Phrase extraction

Input: PennyLane went to the school

Output: [{'Noun Phrase': 'PennyLane'}, {'Verb Phrase': 'went'}, {'Preposition': 'to'}, {'Noun Phrase': 'the school'}]

I train a sequence tagging model based on RoBERTa of Huggingface. The training code is given in train.py.

How to use

from PhrExt import PhraseExtractor

if __name__ == "__main__":
    phrase_extractor = PhraseExtractor('transZ/phrext', 'roberta-base')
    sent = "PennyLane went to the school"
    res = phrase_extractor(sent)
    print(res)

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

PhrExt-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

PhrExt-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file PhrExt-0.1.0.tar.gz.

File metadata

  • Download URL: PhrExt-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for PhrExt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4295be1b7743e8a99b593306b0e103b1cbbf7531309428b1c025af08916109ce
MD5 b93f19778e4c557a04dfdb0f722e17bc
BLAKE2b-256 c69a3a73737133c90bf9d2ece80665e834ba553de13565cb8bb9ce419061766b

See more details on using hashes here.

File details

Details for the file PhrExt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: PhrExt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for PhrExt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0edeb5b9883c5326da332fdfe9a60a38e26d0acb1e433f19dd1aad57564fcc2
MD5 c74f1787d4e178868a36ebcc943ed561
BLAKE2b-256 6b450672b557b4d3947257fcd8f5e23762ba825b2267e0dc35bb2e0acc853477

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