[][src]Trait text_translator::ApiDetect

pub trait ApiDetect: Api {
    fn detect(&self, text: String) -> Result<Option<Language>, Error>;
}

Extends Api to implement language detection.

Required methods

fn detect(&self, text: String) -> Result<Option<Language>, Error>

Detect the language of the selected text.

Inputs

Takes in input only a String containing the text.

Outputs

The method returns a Result<Option<Language>, Error> type:

  • if the API was able to detect the language, it will result in an Ok(Some(detected_language)).
  • if it failed to detect, it will be an Ok(None).
  • if an error preventing the API to do the detection, it will return an error: Error(returned_error).
Loading content...

Implementors

impl<'a> ApiDetect for Yandex<'a>[src]

Loading content...