Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/NeonGeckoCom/neon_utterance_zeroshot_ner_plugin
https://github.com/NeonGeckoCom/neon_utterance_zeroshot_ner_plugin
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/NeonGeckoCom/neon_utterance_zeroshot_ner_plugin
- Owner: NeonGeckoCom
- Created: 2021-11-23T11:27:31.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-15T02:12:38.000Z (almost 3 years ago)
- Last Synced: 2024-02-15T15:32:53.386Z (10 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-ovos-plugins - neon_utterance_zeroshot_ner_plugin - inject context (NER) (OPM plugins / Utterance Transformers)
README
```python
tars = TarsZeroShotNER()# this usually comes from mycroft.conf and is set by transformers service
# labels can be anything, no training needed (zero shot learning)
# the labels in this example are the default values if not set
tars.config = { "labels": ["Organization", "Vehicle", "Location", "City", "Country", "Person"]}utts = ["The Humboldt University of Berlin is situated near the Spree in Berlin, Germany",
"The president of Portugal is Marcelo Rebelo de Sousa"]_, context = tars.transform(utts)
print(context)
# {'zeroshot_ner': {'City': [{'entity': 'City',
# 'source_text': 'The Humboldt University of Berlin '
# 'is situated near the Spree in '
# 'Berlin, Germany',
# 'span': (64, 70),
# 'value': 'Berlin'}],
# 'Country': [{'entity': 'Country',
# 'source_text': 'The Humboldt University of '
# 'Berlin is situated near the '
# 'Spree in Berlin, Germany',
# 'span': (72, 79),
# 'value': 'Germany'}],
# 'Location': [{'entity': 'Location',
# 'source_text': 'The Humboldt University of '
# 'Berlin is situated near the '
# 'Spree in Berlin, Germany',
# 'span': (55, 60),
# 'value': 'Spree'},
# {'entity': 'Location',
# 'source_text': 'The president of Portugal is '
# 'Marcelo Rebelo de Sousa',
# 'span': (17, 25),
# 'value': 'Portugal'}],
# 'Organization': [{'entity': 'Organization',
# 'source_text': 'The Humboldt University of '
# 'Berlin is situated near '
# 'the Spree in Berlin, '
# 'Germany',
# 'span': (4, 33),
# 'value': 'Humboldt University of Berlin'}],
# 'Person': [{'entity': 'Person',
# 'source_text': 'The president of Portugal is '
# 'Marcelo Rebelo de Sousa',
# 'span': (29, 52),
# 'value': 'Marcelo Rebelo de Sousa'}]}}```