1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use lindera_core::{
    dictionary::{Dictionary, UserDictionary},
    word_entry::WordId,
};
use lindera_tokenizer::token::Token;

pub trait DictionaryQuery {
    fn word_id(&self) -> WordId;
    fn dictionary(&self) -> &Dictionary;
    fn user_dictionary(&self) -> Option<&UserDictionary>;
}

impl DictionaryQuery for Token<'_> {
    fn word_id(&self) -> WordId {
        self.word_id
    }
    fn dictionary(&self) -> &Dictionary {
        self.dictionary
    }
    fn user_dictionary(&self) -> Option<&UserDictionary> {
        self.user_dictionary
    }
}