layered_nlp/
lib.rs

1#![doc(
2    html_logo_url = "https://raw.githubusercontent.com/storyscript/layered-nlp/main/assets/layered-nlp.svg",
3    issue_tracker_base_url = "https://github.com/storyscript/layered-nlp/issues/"
4)]
5
6mod create_tokens;
7mod ll_line;
8mod resolvers;
9mod type_bucket;
10mod type_id_to_many;
11
12#[cfg(test)]
13mod tests;
14#[allow(deprecated)]
15pub use create_tokens::create_tokens;
16pub use create_tokens::{create_line_from_input_tokens, InputToken};
17
18/// Simpler, less featureful version of [create_line_from_input_tokens] which uses utf8 counts as string length ([String::len]).
19///
20/// Use [create_line_from_input_tokens] to specify custom string length
21/// calculation function and to supply custom predefined attributes or
22/// custom tokens.
23pub fn create_line_from_string<T: AsRef<str>>(input_string: T) -> LLLine {
24    let token = InputToken::text(input_string.as_ref().to_string(), Vec::new());
25    create_line_from_input_tokens(vec![token], |s| s.len())
26}
27
28pub use ll_line::{
29    x, FinishWith, LLCursorAssignment, LLLine, LLLineDisplay, LLSelection, Resolver, TextTag,
30};
31pub use resolvers::TextMatchAssignResolver;
32pub use type_bucket::AnyAttribute;
33
34/// Shorthand of [LLLineDisplay::new]
35pub fn debug_line<'a>(ll_line: &'a LLLine) -> LLLineDisplay<'a> {
36    LLLineDisplay::new(ll_line)
37}