nl3-rs 1.0.3

Natural language triples — parse plain-English Subject-Predicate-Object phrases into validated triples.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Text classification.

use crate::tagger::Tagger;

/// The classification of an input phrase: its `(token, tag)` parts and trimmed text.
pub(crate) struct Classification {
    pub parts: Vec<(String, String)>,
    #[allow(dead_code)] // kept for parity with the original; not read by the pipeline
    pub text: String,
}

pub(crate) fn classify(text: &str, tagger: &dyn Tagger) -> Classification {
    Classification {
        parts: tagger.tag(text),
        text: text.trim().to_string(),
    }
}