public class MultiThreadedJLanguageTool extends JLanguageTool
JLanguageTool
that uses several threads for rule matching.
Use this if you want text checking to be fast and do not care about the
high load that this might cause. Call shutdown()
when you don't need
the object anymore.
Also see the javadoc of JLanguageTool
.
Thread-safety: this class is not thread-safe, see the remarks at JLanguageTool
.
JLanguageTool.CheckCancelledCallback, JLanguageTool.Level, JLanguageTool.Mode, JLanguageTool.ParagraphHandling
BUILD_DATE, CUSTOM_PATTERN_FILE, DICTIONARY_FILENAME_EXTENSION, FALSE_FRIEND_FILE, GIT_SHORT_ID, MESSAGE_BUNDLE, PARAGRAPH_END_TAGNAME, PATTERN_FILE, SENTENCE_END_TAGNAME, SENTENCE_START_TAGNAME, STYLE_FILE, VERSION
Constructor and Description |
---|
MultiThreadedJLanguageTool(Language language) |
MultiThreadedJLanguageTool(Language language,
int threadPoolSize) |
MultiThreadedJLanguageTool(Language language,
Language motherTongue) |
MultiThreadedJLanguageTool(Language language,
Language motherTongue,
int threadPoolSize,
GlobalConfig globalConfig,
UserConfig userConfig) |
MultiThreadedJLanguageTool(Language language,
Language motherTongue,
int threadPoolSize,
UserConfig userConfig) |
MultiThreadedJLanguageTool(Language language,
Language motherTongue,
UserConfig userConfig) |
Modifier and Type | Method and Description |
---|---|
protected List<AnalyzedSentence> |
analyzeSentences(List<String> sentences) |
protected ExecutorService |
getExecutorService() |
protected int |
getThreadPoolSize()
When no thread pool size is configured, the number of available processors is returned.
|
protected CheckResults |
performCheck(List<AnalyzedSentence> analyzedSentences,
List<String> sentenceTexts,
RuleSet ruleSet,
JLanguageTool.ParagraphHandling paraMode,
AnnotatedText annotatedText,
RuleMatchListener listener,
JLanguageTool.Mode mode,
JLanguageTool.Level level,
boolean checkRemoteRules,
Set<ToneTag> toneTags) |
void |
shutdown()
Call this to shut down the internally used thread pool.
|
void |
shutdownWhenDone()
Call this to shut down the internally used thread pool after all running tasks are finished.
|
activateLanguageModelRules, activateRemoteRules, activateRemoteRules, addMatchFilter, addRule, addTemporaryFile, adjustRuleMatchPos, analyzeText, applyCustomFilters, check, check, check, check, check, check, check, check, check, check, check2, check2, checkAnalyzedSentence, checkAnalyzedSentence, checkInternal, checkInternal, computeSentenceData, disableCategory, disableRule, disableRules, enableRule, enableRuleCategory, fetchRemoteRuleResults, getAllActiveOfficeRules, getAllActiveRules, getAllRules, getAllSpellingCheckRules, getAnalyzedSentence, getCategories, getClassBroker, getDataBroker, getDisabledRules, getLanguage, getMessageBundle, getMessageBundle, getPatternRulesByIdAndSubId, getRawAnalyzedSentence, getUnknownWords, isCategoryDisabled, isCustomPasswordAuthenticatorUsed, loadFalseFriendRules, loadPatternRules, printIfVerbose, printSentenceInfo, rememberUnknownWords, removeTemporaryFiles, sentenceTokenize, setCheckCancelledCallback, setClassBrokerBroker, setCleanOverlappingMatches, setConfigValues, setDataBroker, setListUnknownWords, setMaxErrorsPerWordRate, setOutput, useCustomPasswordAuthenticator
public MultiThreadedJLanguageTool(Language language)
public MultiThreadedJLanguageTool(Language language, int threadPoolSize)
threadPoolSize
- the number of concurrent threads (use 0 or negative value for a default)shutdown()
public MultiThreadedJLanguageTool(Language language, Language motherTongue)
shutdown()
public MultiThreadedJLanguageTool(Language language, Language motherTongue, UserConfig userConfig)
public MultiThreadedJLanguageTool(Language language, Language motherTongue, int threadPoolSize, UserConfig userConfig)
threadPoolSize
- the number of concurrent threadsshutdown()
public MultiThreadedJLanguageTool(Language language, Language motherTongue, int threadPoolSize, GlobalConfig globalConfig, UserConfig userConfig)
threadPoolSize
- the number of concurrent threadsshutdown()
public void shutdown()
public void shutdownWhenDone()
protected int getThreadPoolSize()
protected ExecutorService getExecutorService()
protected List<AnalyzedSentence> analyzeSentences(List<String> sentences) throws IOException
analyzeSentences
in class JLanguageTool
IOException
protected CheckResults performCheck(List<AnalyzedSentence> analyzedSentences, List<String> sentenceTexts, RuleSet ruleSet, JLanguageTool.ParagraphHandling paraMode, AnnotatedText annotatedText, RuleMatchListener listener, JLanguageTool.Mode mode, JLanguageTool.Level level, boolean checkRemoteRules, Set<ToneTag> toneTags)
performCheck
in class JLanguageTool