Package org.languagetool.rules
Class RemoteRuleConfig
java.lang.Object
org.languagetool.rules.RemoteRuleConfig
-
Field Summary
FieldsModifier and TypeFieldDescriptionlongprivate static final com.google.common.cache.LoadingCache<File, List<RemoteRuleConfig>> private static final longprivate static final longprivate static final floatprivate static final intprivate static final intprivate static final intprivate static final Stringprivate static final floatlongfloatstatic final Stringintstatic final Stringintstatic final Stringfloat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanlonglongfloatGets the ID of the fallback rule to use when this rule is not available (e.g., if this is a third-party AI rule and user has opted out)Regex to match language codes for which this rule should be appliedintmiscellaneous options for remote rules allows implementing additional behavior in subclasses some options defined inRemoteRule: fixOffsets: boolean - adjust offsets of matches because of discrepancies in string length for some unicode characters between Java and Python filterMatches: boolean - enable anti-patterns from remote-rule-filters.xml suppressMisspelledMatch: regex - filter out matches with matching rule IDs that have misspelled suggestions suppressMisspelledSuggestions: regex - filter out misspelled suggestions from matches with matching rule IDsintgetPort()static RemoteRuleConfiggetRelevantConfig(String rule, List<RemoteRuleConfig> configs) intfloatgetType()Identifier for the implementation of RemoteRule that this configuration is meant forgetUrl()inthashCode()booleanbased on optionsstatic Predicate<RemoteRuleConfig> isRelevantConfig(String type, Language language) booleanbased on optionsstatic List<RemoteRuleConfig> static List<RemoteRuleConfig> parse(InputStream json) toString()
-
Field Details
-
DEFAULT_PORT
private static final int DEFAULT_PORT- See Also:
-
DEFAULT_BASE_TIMEOUT
private static final long DEFAULT_BASE_TIMEOUT- See Also:
-
DEFAULT_TIMEOUT_PER_CHAR
private static final float DEFAULT_TIMEOUT_PER_CHAR- See Also:
-
DEFAULT_DOWN
private static final long DEFAULT_DOWN- See Also:
-
DEFAULT_FAILURE_RATE_THRESHOLD
private static final float DEFAULT_FAILURE_RATE_THRESHOLD- See Also:
-
DEFAULT_SLIDING_WINDOW_TYPE
-
DEFAULT_SLIDING_WINDOW_SIZE
private static final int DEFAULT_SLIDING_WINDOW_SIZE- See Also:
-
DEFAULT_MINIMUM_NUMBER_OF_CALLS
private static final int DEFAULT_MINIMUM_NUMBER_OF_CALLS- See Also:
-
THIRD_PARTY_AI
- See Also:
-
FALLBACK_RULE_ID
- See Also:
-
PREMIUM
- See Also:
-
configCache
-
ruleId
-
url
-
port
-
baseTimeoutMilliseconds
public long baseTimeoutMilliseconds -
timeoutPerCharacterMilliseconds
public float timeoutPerCharacterMilliseconds -
downMilliseconds
public long downMilliseconds -
failureRateThreshold
public float failureRateThreshold -
slidingWindowType
-
slidingWindowSize
public int slidingWindowSize -
minimumNumberOfCalls
public int minimumNumberOfCalls -
options
-
language
-
type
-
-
Constructor Details
-
RemoteRuleConfig
public RemoteRuleConfig() -
RemoteRuleConfig
-
-
Method Details
-
getRelevantConfig
-
isRelevantConfig
-
parse
- Throws:
IOException
-
load
- Throws:
ExecutionException
-
getFailureRateThreshold
public float getFailureRateThreshold() -
getSlidingWindowType
-
getSlidingWindowSize
public int getSlidingWindowSize() -
getRuleId
-
getUrl
-
getPort
public int getPort() -
getDownMilliseconds
public long getDownMilliseconds() -
getBaseTimeoutMilliseconds
public long getBaseTimeoutMilliseconds() -
getTimeoutPerCharacterMilliseconds
public float getTimeoutPerCharacterMilliseconds() -
getMinimumNumberOfCalls
public int getMinimumNumberOfCalls() -
getOptions
miscellaneous options for remote rules allows implementing additional behavior in subclasses some options defined inRemoteRule: fixOffsets: boolean - adjust offsets of matches because of discrepancies in string length for some unicode characters between Java and Python filterMatches: boolean - enable anti-patterns from remote-rule-filters.xml suppressMisspelledMatch: regex - filter out matches with matching rule IDs that have misspelled suggestions suppressMisspelledSuggestions: regex - filter out misspelled suggestions from matches with matching rule IDs -
getLanguage
Regex to match language codes for which this rule should be applied -
getType
Identifier for the implementation of RemoteRule that this configuration is meant for -
isUsingThirdPartyAI
public boolean isUsingThirdPartyAI()based on options- Returns:
- whether the RemoteRule sends data to a third-party AI model
-
isPremium
public boolean isPremium()based on options- Returns:
- whether the RemoteRule sends data to a third-party AI model
-
getFallbackRuleId
Gets the ID of the fallback rule to use when this rule is not available (e.g., if this is a third-party AI rule and user has opted out)- Returns:
- the ID of the fallback rule, or null if no fallback is configured
-
equals
-
hashCode
public int hashCode() -
toString
-