Struct FastText

Source
pub struct FastText { /* private fields */ }

Implementations§

Source§

impl FastText

Source

pub fn new() -> Self

Source

pub fn get_args(&self) -> Args

Source

pub fn load_model(&mut self, filename: &str) -> Result<(), String>

Source

pub fn save_model(&mut self, filename: &str) -> Result<(), String>

Source

pub fn save_output(&mut self, filename: &str) -> Result<(), String>

Source

pub fn save_vectors(&mut self, filename: &str) -> Result<(), String>

Source

pub fn get_dimension(&self) -> isize

Source

pub fn get_word_id(&self, word: &str) -> Result<isize, String>

Source

pub fn get_subword_id(&self, word: &str) -> Result<isize, String>

Source

pub fn is_quant(&self) -> bool

Source

pub fn train(&mut self, args: &Args) -> Result<(), String>

Source

pub fn predict( &self, text: &str, k: i32, threshold: f32, ) -> Result<Vec<Prediction>, String>

Source

pub fn predict_on_words( &self, words: &[i32], k: i32, threshold: f32, ) -> Result<Vec<Prediction>, String>

Source

pub fn get_vocab(&self) -> Result<(Vec<String>, Vec<i64>), String>

Source

pub fn get_labels(&self) -> Result<(Vec<String>, Vec<i64>), String>

Source

pub fn quantize(&mut self, args: &Args) -> Result<(), String>

Source

pub fn get_word_vector(&self, word: &str) -> Result<Vec<f32>, String>

Source

pub fn tokenize(&self, text: &str) -> Result<Vec<String>, String>

Source

pub fn get_sentence_vector(&self, sentence: &str) -> Result<Vec<f32>, String>

Source

pub fn abort(&self)

Trait Implementations§

Source§

impl Debug for FastText

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FastText

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for FastText

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for FastText

Source§

impl Sync for FastText

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.