Struct textcat::storage::FileContent[][src]

pub struct FileContent { /* fields omitted */ }

Implementations

impl FileContent[src]

pub fn new() -> FileContent[src]

pub fn from_vec(data: Vec<(&str, Vec<&str>)>) -> FileContent[src]

Converts an vector into a struct (the output of self.to_vec())

pub fn to_vec(&self) -> Vec<(&str, Vec<&str>)>[src]

Converts the current structure into a vector (language, [ngrams])

pub fn default_threshold() -> f32[src]

pub fn get_category(&self, sample: &str) -> Option<String>[src]

Returns a single category for a given text. If two categories or more categories that are close together None will be returned.

pub fn get_categories(&self, sample: &str) -> Option<Vec<(String, u64)>>[src]

Returns a sorted list of categories which are candidates and their score (the lower the better)

pub fn persist(&self, output: &str) -> IOResult<()>[src]

Stores the categories in a JSON file.

pub fn add_category(&mut self, name: String, sample: &str)[src]

Add sample text to learn a new category.

pub fn categories(&self) -> Vec<String>[src]

Trait Implementations

impl<'de> Deserialize<'de> for FileContent[src]

impl Serialize for FileContent[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.