Skip to main content

texta-bert-tagger

Project description

TEXTA Bert Tagger Python package

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.

Usage (for versions >=2..)

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}

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-2.2.0.tar.gz (14.0 kB view hashes)

Uploaded Source

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