Skip to main content

texta-bert-tagger

Project description

TEXTA Bert Tagger

Py3.8 Py3.9

Installation

Using built package

pip install texta-bert-tagger

Using Git

pip install git+https://git.texta.ee/texta/texta-bert-tagger-python.git

Testing

python -m pytest -v tests

Documentation

Documentation for version 1.* is available here.

Documentation for version 2.* is available here.

Documentation for version 3.* is available here.

Usage (for versions >=3..)

Fine-tune BERT model

from texta_bert_tagger.tagger import BertTagger
bert_tagger = BertTagger()

data_sample = {"good": ["It was a nice day.", "All was well."], "bad": ["It was horrible.", "What a disaster."]}

# Train a model

# pos_label - used in metrics (precision, recall, f1-score etc) calculations as true label
bert_tagger.train(data_sample, pos_label="bad", n_epochs=2)

# Predict
result = bert_tagger.tag_text("How awful!")
print(result)

Output

[{"prediction": "bad", "probability": 0.55200404, "attributions": {}}]

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

texta-bert-tagger-3.0.2.tar.gz (30.5 kB view details)

Uploaded Source

File details

Details for the file texta-bert-tagger-3.0.2.tar.gz.

File metadata

  • Download URL: texta-bert-tagger-3.0.2.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for texta-bert-tagger-3.0.2.tar.gz
Algorithm Hash digest
SHA256 9719cea7e8288f76ed8593694836fafd0e9c8d544d767793201c39f09e11a0cb
MD5 f3e2a1daa6f34f1e960813896f24f76f
BLAKE2b-256 e0326e61503d7dfafea7f382a15eeb91d9e95cf147cc768c7010c5ef41ba157a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page