Skip to main content

sudachi/
analysis.rs

1/*
2 *  Copyright (c) 2021-2026 Works Applications Co., Ltd.
3 *
4 *  Licensed under the Apache License, Version 2.0 (the "License");
5 *  you may not use this file except in compliance with the License.
6 *  You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *   Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 */
16
17pub mod created;
18mod inner;
19pub mod lattice;
20pub mod mlist;
21pub mod mode;
22pub mod morpheme;
23pub mod node;
24pub mod stateful_tokenizer;
25pub mod stateless_tokenizer;
26
27pub use inner::Node;
28pub use mode::Mode;
29
30use crate::analysis::mlist::MorphemeList;
31use crate::error::SudachiResult;
32
33/// Able to tokenize Japanese text
34pub trait Tokenize {
35    type Dictionary;
36
37    /// Break text into `Morpheme`s
38    fn tokenize(
39        &self,
40        input: &str,
41        mode: Mode,
42        enable_debug: bool,
43    ) -> SudachiResult<MorphemeList<Self::Dictionary>>;
44}