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
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
PhrExt-0.1.0.tar.gz
(6.4 kB
view hashes)
Built Distribution
PhrExt-0.1.0-py3-none-any.whl
(7.5 kB
view hashes)