Skip to content

enterprise-search/crfsuite-rs

 
 

Repository files navigation

crfsuite-rs

Rust Python codecov Crates.io docs.rs PyPI

Rust binding to crfsuite

Installation

Add it to your Cargo.toml:

[dependencies]
crfsuite = "0.3"

Add extern crate crfsuite to your crate root and your're good to go!

Python package

There is also a Python package named crfsuite, you can install it via pip:

pip install -U crfsuite

Usage example:

from crfsuite import Model

if __name__ == '__main__':
    model = Model('path/to/crfsuite/model.crf')
    tagged = model.tag(["abc", "def"])
    print(tagged)

Run

RUST_LOG=info cargo run --example train -- -p c1=0.1 -p c2=0.1 -p max_iterations=100 -p feature.possible_transitions=1 -m ner train.data -v -v
RUST_LOG=info cargo run --example tag -- -t -m ner test.data

Benchmark

cargo bench --bench predict_benchmark
python3 -m locust --host http://localhost:8080 -f locustfile.py

Internal

  • interface refine
    • fit (train)
    • evaluate
model.fit(train_images, 
        train_labels,
        epochs=50, 
        batch_size=batch_size, 
        callbacks=[cp_callback],
        validation_data=(test_images, test_labels),
        verbose=0)
loss, acc = model.evaluate(test_images, test_labels, verbose=2)
model.save('my_model.keras')
model = load_model('my_model.keras')
new_model.summary()
new_model.predict(test_images)

Performance

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.

About

Rust binding to crfsuite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 91.6%
  • Python 5.9%
  • C 1.4%
  • Other 1.1%