Struct languagetool_rust::check::CheckRequest
source · [−]pub struct CheckRequest {Show 15 fields
pub raw: bool,
pub text: Option<String>,
pub data: Option<Data>,
pub language: String,
pub username: Option<String>,
pub api_key: Option<String>,
pub dicts: Option<Vec<String>>,
pub mother_tongue: Option<String>,
pub preferred_variants: Option<Vec<String>>,
pub enabled_rules: Option<Vec<String>>,
pub disabled_rules: Option<Vec<String>>,
pub enabled_categories: Option<Vec<String>>,
pub disabled_categories: Option<Vec<String>>,
pub enabled_only: bool,
pub level: Level,
}
Expand description
LanguageTool POST check request.
The main feature - check a text with LanguageTool for possible style and grammar issues.
The structure below tries to follow as closely as possible the JSON API decribed here.
Fields
raw: bool
cli
and annotate
only.If present, raw JSON output will be printed instead of annotated text.
text: Option<String>
The text to be checked. This or ‘data’ is required.
data: Option<Data>
The text to be checked, given as a JSON document that specifies what’s text and what’s markup. This or ‘text’ is required.
Markup will be ignored when looking for errors. Example text:
A <b>test</b>
JSON for the example text:
{"annotation":[
{"text": "A "},
{"markup": "<b>"},
{"text": "test"},
{"markup": "</b>"}
]}
If you have markup that should be interpreted as whitespace, like
in HTML, you can have it interpreted like this:
{"markup": "<p>", "interpretAs": "\n\n"}
The ‘data’ feature is not limited to HTML or XML, it can be used for any kind of markup. Entities will need to be expanded in this input.
language: String
A language code like en-US
, de-DE
, fr
, or auto
to guess the language automatically (see preferredVariants
below).
For languages with variants (English, German, Portuguese) spell checking will only be activated when you specify the variant, e.g. en-GB
instead of just en
.
username: Option<String>
Set to get Premium API access: Your username/email as used to log in at languagetool.org.
api_key: Option<String>
Set to get Premium API access: your API key
dicts: Option<Vec<String>>
Comma-separated list of dictionaries to include words from; uses special default dictionary if this is unset
mother_tongue: Option<String>
A language code of the user’s native language, enabling false friends checks for some language pairs.
preferred_variants: Option<Vec<String>>
Comma-separated list of preferred language variants.
The language detector used with language=auto
can detect e.g. English, but it cannot decide whether British English or American English is used. Thus this parameter can be used to specify the preferred variants like en-GB
and de-AT
. Only available with language=auto
. You should set variants for at least German and English, as otherwise the spell checking will not work for those, as no spelling dictionary can be selected for just en
or de
.
enabled_rules: Option<Vec<String>>
IDs of rules to be enabled, comma-separated
disabled_rules: Option<Vec<String>>
IDs of rules to be disabled, comma-separated
enabled_categories: Option<Vec<String>>
IDs of categories to be enabled, comma-separated
disabled_categories: Option<Vec<String>>
IDs of categories to be disabled, comma-separated
enabled_only: bool
If true, only the rules and categories whose IDs are specified with enabledRules
or enabledCategories
are enabled.
level: Level
If set to picky
, additional rules will be activated, i.e. rules that you might only find useful when checking formal text.
Implementations
sourceimpl CheckRequest
impl CheckRequest
Trait Implementations
sourceimpl Args for CheckRequest
impl Args for CheckRequest
sourceimpl CommandFactory for CheckRequest
impl CommandFactory for CheckRequest
sourcefn into_app<'b>() -> Command<'b>
fn into_app<'b>() -> Command<'b>
Replaced with `CommandFactory::command
Deprecated, replaced with CommandFactory::command
sourcefn into_app_for_update<'b>() -> Command<'b>
fn into_app_for_update<'b>() -> Command<'b>
Replaced with `CommandFactory::command_for_update
Deprecated, replaced with CommandFactory::command_for_update
sourcefn command_for_update<'help>() -> App<'help>
fn command_for_update<'help>() -> App<'help>
sourceimpl Debug for CheckRequest
impl Debug for CheckRequest
sourceimpl Default for CheckRequest
impl Default for CheckRequest
sourcefn default() -> CheckRequest
fn default() -> CheckRequest
Returns the “default value” for a type. Read more
sourceimpl FromArgMatches for CheckRequest
impl FromArgMatches for CheckRequest
sourcefn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Instantiate Self
from ArgMatches
, parsing the arguments as needed. Read more
sourcefn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
Assign values from ArgMatches
to self
.
sourceimpl Parser for CheckRequest
impl Parser for CheckRequest
sourcefn parse_from<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, exit on error
sourcefn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, return Err on error.
sourcefn update_from<I, T>(&mut self, itr: I) where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I) where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, exit on error
sourcefn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, return Err on error.
sourceimpl Serialize for CheckRequest
impl Serialize for CheckRequest
Auto Trait Implementations
impl RefUnwindSafe for CheckRequest
impl Send for CheckRequest
impl Sync for CheckRequest
impl Unpin for CheckRequest
impl UnwindSafe for CheckRequest
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more