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.1.2.tar.gz
(114.5 kB
view hashes)
Built Distributions
Close
Hashes for chaine-1.1.2-cp39-cp39-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d8b1ef69edaa08af2b71bc636950c0a992563034ca8363c4c48853e4e6825c8 |
|
MD5 | 473704841ea8bf87616d3830b695a31b |
|
BLAKE2b-256 | ceb7dad9174e85a59e0ba04628061df2ed2672b45e9f48fc06810075d4c372f8 |
Close
Hashes for chaine-1.1.2-cp38-cp38-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a5198f1af70c1c4bcaa33c11f9f3aeeb5db74b0b9701470fa452f8ed15dba1b |
|
MD5 | de66fe99d2db9ea86f86fa3eb1ba5013 |
|
BLAKE2b-256 | dfd2c77d1950f48a0bfd59fa313bd4c2db98d1dd88582c2c68b497f50539da40 |