KO
|
EN
gitlite โ search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
tokesies
โ 11
Open GitHub โ
A string tokenizer library for Rust
Download README (.md)
Explore Similar Repositories
adonis-swagger-jsdoc
:
An adonis js wrapper for swagger-jsdoc for documenting APIs
adonis-generic-exceptions
:
A module with all generic exceptions other modules can use
learning-coccinelle
:
Learning Coccinelle
laravel-uploadify
:
Library for Laravel that handles image uploading with renaming, showing thumbnail image with custom route and more.
EasyGCD
:
๐ฏA tiny library to make using GCD easier.
// repository documentation
Was this content helpful?
โ 0
(0 ratings)
Select Rating:
โ
โ
โ
โ
โ
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
tokesies
?
Download (.md)
 A string tokenizer library for Rust, where characters used to separate tokens may also be conditionally selected to be a token themselves. There are filter implementations provided for a few basic use cases: ```rust use tokesies::*; let line = "hello!world, this is some_text"; let tokens = FilteredTokenizer::new(filters::DefaultFilter{}, line).collect::<Vec<Token>>(); // tokens: ["hello", "!", "world", ",", "this", "is", "some", "_", "text"] assert_eq!(tokens.get(0).unwrap().term(), "hello"); ``` You can alternatively provide a custom implementation: ```rust use tokesies::*; pub struct MyFilter; impl filters::Filter for MyFilter { fn on_char(&self, c: &char) -> (bool, bool) { match *c { ' ' => (true, false), ',' => (true, true), _ => (false, false), } } } let line = "hello!world, this is some_text"; let tokens = FilteredTokenizer::new(MyFilter{}, line).collect::<Vec<Token>>(); // tokens: ["hello!world", ",", "this", "is", "some_text"] assert_eq!(tokens.get(0).unwrap().term(), "hello!world"); ``` Implementation is derived largely from [this blog][0] by [@daschl][1]. ## Contributing and customizing Contributions are very welcome, just fork and submit a pull request. [0]: http://nitschinger.at/Text-Analysis-in-Rust-Tokenization/ [1]: https://github.com/daschl