xt-nlp
Description
This repo contains common NLP pre/post processing functions, loss functions, metrics, and helper functions.
Installation
From PyPI:
pip install xt-nlp
From source:
git clone https://github.com/XtractTech/xt-nlp.git
pip install ./xt-nlp
Usage
See specific help on a class or function using help. E.g., help(SESLoss).
Defining SES Metrics and Loss
from xt_nlp.metrics import SESF1
from xt_nlp.metrics import SESLoss
eval_metrics = {
'f1': SESF1(threshold=0.8)
}
loss_fn = SESLoss()
Read BRAT annotations for sequence extraction into data loader
from xt_nlp.utils import get_brat_examples, split_examples, get_features, build_ses_dataloader
# tokenizer =
# max_sequence_length =
# doc_stride =
# class_dict = Dictionary mapping classname ==> list of classes to group into this class
# classes =
# batch_size =
# workers =
examples = get_brat_examples(
datadir='./data/datadir',
classes=classes
)
train_examples, val_examples = split_examples(examples, train_prop=.9, seed=4000)
train_features = get_features(
examples=train_examples,
tokenizer=tokenizer,
all_ans_types=classes,
max_seq_len=max_sequence_length,
doc_stride=doc_stride,
mode='train'
)
train_loader = build_ses_dataloader(
train_features,
classes,
class_dict,
batch_size=batch_size,
workers=workers,
max_seq_length=max_sequence_length,
shuffle=True
)
Metadata
Release files for xt-nlp 0.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xt-nlp-0.2.7.tar.gz | 19.1 kB | Without provenance | Details for xt-nlp-0.2.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xt_nlp-0.2.7-py3-none-any.whl | Python 3 | none | any | Details for xt_nlp-0.2.7-py3-none-any.whl |
Total release size: 40.5 kB
Release files / xt-nlp-0.2.7.tar.gz
| Download URL | xt-nlp-0.2.7.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6016607478ad1414c42501947a2ac47060d795e54799f0a2f331453cfe6b1b0
|
|
BLAKE2b-256 checksum How to use checksums |
a9861fb2595aa73ff6c03cd2f58aac698a96a55394c2d9a3e9eb5338a49adaa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6
|
Release files / xt_nlp-0.2.7-py3-none-any.whl
| Download URL | xt_nlp-0.2.7-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3599c4d8429258b2cbc6b91544f3156388841bc65cb09114466911dc9bcd8dff
|
|
BLAKE2b-256 checksum How to use checksums |
955e7793f4745de5a3d594103b7992f83a032f8e170900b79525a3dd05db0898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6
|
Security for xt-nlp 0.2.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.