Struct textcat::storage::FileContent [−][src]
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for FileContent
[src]
Auto Trait Implementations
impl RefUnwindSafe for FileContent
impl Send for FileContent
impl Sync for FileContent
impl Unpin for FileContent
impl UnwindSafe for FileContent
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,