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.

Files for texta-bert-tagger, version 2.3.6
Filename, size File type Python version Upload date Hashes
Filename, size texta-bert-tagger-2.3.6.tar.gz (14.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page