[][src]Struct punkt::TrainingData

pub struct TrainingData { /* fields omitted */ }

Stores data that was obtained during training.

Examples

Precompiled data can be loaded via a language specific constructor.

let eng_data = TrainingData::english();
let ger_data = TrainingData::german();

assert!(eng_data.contains_abbrev("va"));
assert!(ger_data.contains_abbrev("crz"));

Methods

impl TrainingData[src]

pub fn new() -> TrainingData[src]

Creates a new, empty data object.

pub fn contains_abbrev(&self, tok: &str) -> bool[src]

Check if a token is considered to be an abbreviation.

pub fn contains_sentence_starter(&self, tok: &str) -> bool[src]

Check if a token is considered to be a token that commonly starts a sentence.

pub fn contains_collocation(&self, left: &str, right: &str) -> bool[src]

Checks if a pair of words are commonly known to appear together.

pub fn get_orthographic_context(&self, tok: &str) -> u8[src]

Gets the orthographic context for a token. Returns 0 if the token was not yet encountered.

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

impl TrainingData[src]

Trait Implementations

impl Default for TrainingData[src]

impl Debug for TrainingData[src]

impl FromStr for TrainingData[src]

type Err = &'static str

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<TrainingData, &'static str>[src]

Deserializes JSON and loads the data into a new TrainingData object.

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.