gliner/text/
token.rs

1/// A token with text and start/end offsets
2#[derive(Debug)]
3pub struct Token {
4    start: usize,
5    end: usize,
6    text: String,
7}
8
9
10impl Token {
11    pub fn new(start: usize, end: usize, text: &str) -> Self {
12        Self { 
13            start, end, 
14            text: text.to_string() 
15        }
16    }
17
18    pub fn start(&self) -> usize {
19        self.start
20    }
21
22    pub fn end(&self) -> usize {
23        self.end
24    }
25
26    pub fn text(&self) -> &str {
27        &self.text
28    }
29}
30
31
32
33