Skip to main content

A lightweight Linear-Chain Conditional Random Field

Project description

A lightweight Linear-Chain Conditional Random Field

This is a modern, fast and no-dependency Python library implementing a linear-chain conditional random field for natural language processing tasks like named entity recognition or part-of-speech tagging.

Installation

You can install the latest stable version from PyPI:

$ pip install chaine

Example

>>> import chaine
>>> import datasets
>>> data = datasets.load_dataset("germeval_14")
>>> tokens = data["train"]["tokens"]
>>> labels = data["train"]["ner_tags"]
>>> crf = chaine.train(tokens, labels, max_iterations=100)
>>> sequence = chaine.featurize(["todo", "todo", "todo"])
>>> crf.predict(sequence)
["O", "O", "B-PER"]

Disclaimer

This library makes use of and is partially based on:

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

chaine-0.1.0.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distributions

chaine-0.1.0-cp39-cp39-manylinux2014_x86_64.whl (913.5 kB view hashes)

Uploaded CPython 3.9

chaine-0.1.0-cp38-cp38-manylinux2014_x86_64.whl (913.5 kB view hashes)

Uploaded CPython 3.8

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