1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Text analysis chain for Lindera.
//!
//! This crate layers Lucene-style text analysis on top of the pure
//! morphological segmenter provided by the [`lindera`] crate:
//!
//! - [`character_filter`]: transforms the input text before segmentation
//! (with offset correction back to the original text)
//! - [`token_filter`]: transforms the tokens produced by the segmenter
//! - [`tokenizer`]: composes character filters, a
//! [`Segmenter`](lindera::segmenter::Segmenter), and token filters into a
//! single pipeline, configurable programmatically or via a YAML file
use Value;
use LinderaResult;
use LinderaErrorKind;
/// Parses a CLI-style filter flag of the form `kind:{"arg": ...}` into the
/// filter kind and its JSON arguments.
///
/// # Arguments
///
/// * `cli_flag` - The flag string, e.g. `lowercase` or `length:{"max": 10}`.
///
/// # Returns
///
/// A tuple of the filter kind and the parsed JSON arguments.