Linear-chain conditional random fields for natural language processing
Project description
Chaine
Linear-chain conditional random fields for natural language processing.
Chaine is a modern Python library without third-party dependencies and a backend written in C. You can train conditional random fields for natural language processing tasks like named entity recognition.
- Lightweight: No use of bloated third-party libraries.
- Fast: Performance critical parts are written in C and thus blazingly fast.
- Easy to use: Designed with special focus on usability and a beautiful high-level API.
You can install the latest stable version from PyPI:
$ pip install chaine
Please refer to the introducing paper by Lafferty et al. for the theoretical concepts behind conditional random fields.
Minimal working example
>>> import chaine
>>> tokens = [["John", "Lennon", "was", "born", "in", "Liverpool"]]
>>> labels = [["B-PER", "I-PER", "O", "O", "O", "B-LOC"]]
>>> model = chaine.train(tokens, labels, max_iterations=5)
>>> model.predict(tokens)
[['B-PER', 'I-PER', 'O', 'O', 'O', 'B-LOC']]
Check out the examples for a more real-world use case.
Credits
This project makes use of and is partially based on:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chaine-1.0.0.tar.gz
(114.7 kB
view hashes)
Built Distributions
Close
Hashes for chaine-1.0.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7832d9ab423e52c0d72f7c967d672c3147949da48abe1aec6a8f1dc1f9e1de1 |
|
MD5 | a326990d1f3f812067af6d94e770fa26 |
|
BLAKE2b-256 | 9e1bbd0c7d6b56a88e7e34add50920d4981fc957dd3017c5a52b336e367f37ba |
Close
Hashes for chaine-1.0.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e889b933c039b7b8c28f04f818a48b59fa87a8efb4ef9557db137c373aa5fa5 |
|
MD5 | 1c697450b10a7cd5d808fb947a638fba |
|
BLAKE2b-256 | 1b9b0d4c6bb364f21e3cb81fb504a7b5a380b44f8a4dd090e9dc463bd241ffcb |