Package org.languagetool.rules
Class TestRemoteRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.RemoteRule
org.languagetool.rules.TestRemoteRule
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.languagetool.rules.RemoteRule
RemoteRule.RemoteRequest -
Field Summary
FieldsFields inherited from class org.languagetool.rules.RemoteRule
circuitBreakers, filterMatches, fixOffsets, inputLogging, lt, premium, ruleLanguage, serviceConfiguration, shutdownRoutines, suppressMisspelledMatch, suppressMisspelledSuggestions, whitespaceNormalisation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Callable<RemoteRuleResult> executeRequest(RemoteRule.RemoteRequest request, long timeoutMilliseconds) protected RemoteRuleResultfallbackResults(RemoteRule.RemoteRequest request) fallback if executeRequest times out or throws an errorA short description of the error this rule can detect, usually in the language of the text that is checked.protected RemoteRule.RemoteRequestprepareRequest(List<AnalyzedSentence> sentences, Long textSessionId) run local preprocessing steps (or just store sentences)private RuleMatchMethods inherited from class org.languagetool.rules.RemoteRule
circuitBreaker, computeOffsetShifts, createCircuitBreaker, fixMatchOffsets, getCircuitBreakerConfig, getId, getServiceConfiguration, getTimeout, getTimeout, isPremium, match, run, run, shutdownMethods inherited from class org.languagetool.rules.Rule
addExamplePair, addTags, addToneTags, cacheAntiPatterns, estimateContextForSureMatch, getAntiPatterns, getCategory, getCorrectExamples, getDistanceTokens, getErrorTriggeringExamples, getFullId, getIncorrectExamples, getLocQualityIssueType, getMinPrevMatches, getPriority, getRuleOptions, getSentenceWithImmunization, getSourceFile, getSubId, getTags, getToneTags, getUrl, hasTag, hasToneTag, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isGoalSpecific, isIncludedInHiddenMatches, isOfficeDefaultOff, isOfficeDefaultOn, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setDistanceTokens, setErrorTriggeringExamples, setExamplePair, setGoalSpecific, setIncludedInHiddenMatches, setIncorrectExamples, setLocQualityIssueType, setMinPrevMatches, setOfficeDefaultOff, setOfficeDefaultOn, setPremium, setPriority, setTags, setToneTags, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
-
Field Details
-
waitTime
private long waitTime
-
-
Constructor Details
-
TestRemoteRule
-
-
Method Details
-
prepareRequest
protected RemoteRule.RemoteRequest prepareRequest(List<AnalyzedSentence> sentences, Long textSessionId) Description copied from class:RemoteRulerun local preprocessing steps (or just store sentences)- Specified by:
prepareRequestin classRemoteRule- Parameters:
sentences- text to processtextSessionId- session ID for caching, partial rollout, A/B testing- Returns:
- parameter for executeRequest/fallbackResults
-
testMatch
-
executeRequest
protected Callable<RemoteRuleResult> executeRequest(RemoteRule.RemoteRequest request, long timeoutMilliseconds) throws TimeoutException - Specified by:
executeRequestin classRemoteRule- Parameters:
request- returned by prepareRequesttimeoutMilliseconds- timeout for this operation, <=0 -> unlimited- Returns:
- callable that sends request, parses and returns result for this remote rule
- Throws:
TimeoutException- if timeout was exceeded
-
fallbackResults
Description copied from class:RemoteRulefallback if executeRequest times out or throws an error- Specified by:
fallbackResultsin classRemoteRule- Parameters:
request- returned by prepareRequest- Returns:
- local results for this rule
-
getDescription
Description copied from class:RuleA short description of the error this rule can detect, usually in the language of the text that is checked.- Specified by:
getDescriptionin classRule
-