Struct lingua::LanguageDetectorBuilder [−][src]
pub struct LanguageDetectorBuilder { /* fields omitted */ }
This struct configures and creates an instance of LanguageDetector.
Implementations
impl LanguageDetectorBuilder
[src]
impl LanguageDetectorBuilder
[src]pub fn from_all_languages() -> Self
[src]
pub fn from_all_languages() -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with all built-in languages.
pub fn from_all_spoken_languages() -> Self
[src]
pub fn from_all_spoken_languages() -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with all built-in spoken languages.
pub fn from_all_languages_with_arabic_script() -> Self
[src]
pub fn from_all_languages_with_arabic_script() -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with all built-in languages supporting the Arabic script.
pub fn from_all_languages_with_cyrillic_script() -> Self
[src]
pub fn from_all_languages_with_cyrillic_script() -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with all built-in languages supporting the Cyrillic script.
pub fn from_all_languages_with_devanagari_script() -> Self
[src]
pub fn from_all_languages_with_devanagari_script() -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with all built-in languages supporting the Devanagari script.
pub fn from_all_languages_with_latin_script() -> Self
[src]
pub fn from_all_languages_with_latin_script() -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with all built-in languages supporting the Latin script.
pub fn from_all_languages_without(languages: &[Language]) -> Self
[src]
pub fn from_all_languages_without(languages: &[Language]) -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with all built-in languages except those specified in languages
.
⚠ Panics if less than two languages
are specified.
pub fn from_languages(languages: &[Language]) -> Self
[src]
pub fn from_languages(languages: &[Language]) -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with the specified languages
.
⚠ Panics if less than two languages
are specified.
pub fn from_iso_codes_639_1(iso_codes: &[IsoCode639_1]) -> Self
[src]
pub fn from_iso_codes_639_1(iso_codes: &[IsoCode639_1]) -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with the languages specified by the respective ISO 639-1 codes.
⚠ Panics if less than two iso_codes
are specified.
pub fn from_iso_codes_639_3(iso_codes: &[IsoCode639_3]) -> Self
[src]
pub fn from_iso_codes_639_3(iso_codes: &[IsoCode639_3]) -> Self
[src]Creates and returns an instance of LanguageDetectorBuilder
with the languages specified by the respective ISO 639-3 codes.
⚠ Panics if less than two iso_codes
are specified.
pub fn with_minimum_relative_distance(&mut self, distance: f64) -> &mut Self
[src]
pub fn with_minimum_relative_distance(&mut self, distance: f64) -> &mut Self
[src]Sets the desired value for the minimum relative distance measure.
By default, Lingua returns the most likely language for a given input text. However, there are certain words that are spelled the same in more than one language. The word prologue, for instance, is both a valid English and French word. Lingua would output either English or French which might be wrong in the given context. For cases like that, it is possible to specify a minimum relative distance that the logarithmized and summed up probabilities for each possible language have to satisfy.
Be aware that the distance between the language probabilities is
dependent on the length of the input text. The longer the input
text, the larger the distance between the languages. So if you
want to classify very short text phrases, do not set the minimum
relative distance too high. Otherwise you will get most results
returned as None
which is the return value for cases
where language detection is not reliably possible.
⚠ Panics if distance
is smaller than 0.0 or greater than 0.99.
pub fn with_preloaded_language_models(&mut self) -> &mut Self
[src]
pub fn with_preloaded_language_models(&mut self) -> &mut Self
[src]Preloads all language models when creating the instance of LanguageDetector.
By default, Lingua uses lazy-loading to load only those language models on demand which are considered relevant by the rule-based filter engine. For web services, for instance, it is rather beneficial to preload all language models into memory to avoid unexpected latency while waiting for the service response. This method allows to switch between these two loading modes.
pub fn build(&mut self) -> LanguageDetector
[src]
pub fn build(&mut self) -> LanguageDetector
[src]Creates and returns the configured instance of LanguageDetector.
Auto Trait Implementations
impl RefUnwindSafe for LanguageDetectorBuilder
impl Send for LanguageDetectorBuilder
impl Sync for LanguageDetectorBuilder
impl Unpin for LanguageDetectorBuilder
impl UnwindSafe for LanguageDetectorBuilder
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T