pub struct LanguageDetectorBuilder { /* private fields */ }
Expand description

This struct configures and creates an instance of LanguageDetector.

Implementations

Creates and returns an instance of LanguageDetectorBuilder with all built-in languages.

Creates and returns an instance of LanguageDetectorBuilder with all built-in spoken languages.

Creates and returns an instance of LanguageDetectorBuilder with all built-in languages supporting the Arabic script.

Creates and returns an instance of LanguageDetectorBuilder with all built-in languages supporting the Cyrillic script.

Creates and returns an instance of LanguageDetectorBuilder with all built-in languages supporting the Devanagari script.

Creates and returns an instance of LanguageDetectorBuilder with all built-in languages supporting the Latin script.

Creates and returns an instance of LanguageDetectorBuilder with all built-in languages except those specified in languages.

⚠ Panics if less than two languages are used to build the LanguageDetector.

Creates and returns an instance of LanguageDetectorBuilder with the specified languages.

⚠ Panics if less than two languages are specified.

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.

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.

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.

Configures LanguageDetectorBuilder to preload 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.

Creates and returns the configured instance of LanguageDetector.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.