id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
19,100
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/Unifier.java
Unifier.isUnified
public final boolean isUnified(AnalyzedToken matchToken, Map<String, List<String>> uFeatures, boolean lastReading, boolean isMatched) { if (inUnification) { if (isMatched) { uniMatched |= isSatisfied(matchToken, uFeatures); } uniAllMatched = uniMatched; if (lastReading) { ...
java
public final boolean isUnified(AnalyzedToken matchToken, Map<String, List<String>> uFeatures, boolean lastReading, boolean isMatched) { if (inUnification) { if (isMatched) { uniMatched |= isSatisfied(matchToken, uFeatures); } uniAllMatched = uniMatched; if (lastReading) { ...
[ "public", "final", "boolean", "isUnified", "(", "AnalyzedToken", "matchToken", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "uFeatures", ",", "boolean", "lastReading", ",", "boolean", "isMatched", ")", "{", "if", "(", "inUnification", ")"...
Tests if the token sequence is unified. <p>Usage note: to test if the sequence of tokens is unified (i.e., shares a group of features, such as the same gender, number, grammatical case etc.), you need to test all tokens but the last one in the following way: call {@code isUnified()} for every reading of a token, and s...
[ "Tests", "if", "the", "token", "sequence", "is", "unified", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/Unifier.java#L403-L427
19,101
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/morfologik/MorfologikSpellerRule.java
MorfologikSpellerRule.isSurrogatePairCombination
protected boolean isSurrogatePairCombination (String word) { if (word.length() > 1 && word.length() % 2 == 0 && word.codePointCount(0, word.length()) != word.length()) { // some symbols such as emojis (๐Ÿ˜‚) have a string length that equals 2 boolean isSurrogatePairCombination = true; for (int i = 0...
java
protected boolean isSurrogatePairCombination (String word) { if (word.length() > 1 && word.length() % 2 == 0 && word.codePointCount(0, word.length()) != word.length()) { // some symbols such as emojis (๐Ÿ˜‚) have a string length that equals 2 boolean isSurrogatePairCombination = true; for (int i = 0...
[ "protected", "boolean", "isSurrogatePairCombination", "(", "String", "word", ")", "{", "if", "(", "word", ".", "length", "(", ")", ">", "1", "&&", "word", ".", "length", "(", ")", "%", "2", "==", "0", "&&", "word", ".", "codePointCount", "(", "0", ",...
Checks whether a given String consists only of surrogate pairs. @param word to be checked @since 4.2
[ "Checks", "whether", "a", "given", "String", "consists", "only", "of", "surrogate", "pairs", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/morfologik/MorfologikSpellerRule.java#L346-L356
19,102
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRule.java
PatternRule.canBeIgnoredFor
public boolean canBeIgnoredFor(AnalyzedSentence sentence) { return (!simpleRuleTokens.isEmpty() && !sentence.getTokenSet().containsAll(simpleRuleTokens)) || (!inflectedRuleTokens.isEmpty() && !sentence.getLemmaSet().containsAll(inflectedRuleTokens)); }
java
public boolean canBeIgnoredFor(AnalyzedSentence sentence) { return (!simpleRuleTokens.isEmpty() && !sentence.getTokenSet().containsAll(simpleRuleTokens)) || (!inflectedRuleTokens.isEmpty() && !sentence.getLemmaSet().containsAll(inflectedRuleTokens)); }
[ "public", "boolean", "canBeIgnoredFor", "(", "AnalyzedSentence", "sentence", ")", "{", "return", "(", "!", "simpleRuleTokens", ".", "isEmpty", "(", ")", "&&", "!", "sentence", ".", "getTokenSet", "(", ")", ".", "containsAll", "(", "simpleRuleTokens", ")", ")",...
A fast check whether this rule can be ignored for the given sentence because it can never match. Used internally for performance optimization. @since 2.4
[ "A", "fast", "check", "whether", "this", "rule", "can", "be", "ignored", "for", "the", "given", "sentence", "because", "it", "can", "never", "match", ".", "Used", "internally", "for", "performance", "optimization", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRule.java#L248-L251
19,103
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRule.java
PatternRule.getSet
private Set<String> getSet(boolean isInflected) { Set<String> set = new HashSet<>(); for (PatternToken patternToken : patternTokens) { boolean acceptInflectionValue = isInflected ? patternToken.isInflected() : !patternToken.isInflected(); if (acceptInflectionValue && !patternToken.getNegation() && !...
java
private Set<String> getSet(boolean isInflected) { Set<String> set = new HashSet<>(); for (PatternToken patternToken : patternTokens) { boolean acceptInflectionValue = isInflected ? patternToken.isInflected() : !patternToken.isInflected(); if (acceptInflectionValue && !patternToken.getNegation() && !...
[ "private", "Set", "<", "String", ">", "getSet", "(", "boolean", "isInflected", ")", "{", "Set", "<", "String", ">", "set", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "PatternToken", "patternToken", ":", "patternTokens", ")", "{", "boolean", ...
tokens that just refer to a word - no regex and optionally no inflection etc.
[ "tokens", "that", "just", "refer", "to", "a", "word", "-", "no", "regex", "and", "optionally", "no", "inflection", "etc", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRule.java#L254-L267
19,104
languagetool-org/languagetool
languagetool-wikipedia/src/main/java/org/languagetool/dev/index/PatternRuleQueryBuilder.java
PatternRuleQueryBuilder.buildRelaxedQuery
public Query buildRelaxedQuery(AbstractPatternRule rule) throws UnsupportedPatternRuleException { BooleanQuery.Builder builder = new BooleanQuery.Builder(); for (PatternToken patternToken : rule.getPatternTokens()) { try { BooleanClause clause = makeQuery(patternToken); builder.add(cl...
java
public Query buildRelaxedQuery(AbstractPatternRule rule) throws UnsupportedPatternRuleException { BooleanQuery.Builder builder = new BooleanQuery.Builder(); for (PatternToken patternToken : rule.getPatternTokens()) { try { BooleanClause clause = makeQuery(patternToken); builder.add(cl...
[ "public", "Query", "buildRelaxedQuery", "(", "AbstractPatternRule", "rule", ")", "throws", "UnsupportedPatternRuleException", "{", "BooleanQuery", ".", "Builder", "builder", "=", "new", "BooleanQuery", ".", "Builder", "(", ")", ";", "for", "(", "PatternToken", "patt...
Iterate over all elements, ignore those not supported, add the other ones to a BooleanQuery. @throws UnsupportedPatternRuleException if no query could be created for the rule
[ "Iterate", "over", "all", "elements", "ignore", "those", "not", "supported", "add", "the", "other", "ones", "to", "a", "BooleanQuery", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-wikipedia/src/main/java/org/languagetool/dev/index/PatternRuleQueryBuilder.java#L69-L87
19,105
languagetool-org/languagetool
languagetool-standalone/src/main/java/org/languagetool/gui/LanguageManagerDialog.java
LanguageManagerDialog.getLanguages
List<Language> getLanguages() throws IllegalAccessException, InstantiationException { List<Language> languages = new ArrayList<>(); for (File ruleFile : ruleFiles) { if (ruleFile != null) { Language newLanguage = LanguageBuilder.makeAdditionalLanguage(ruleFile); languages.add(newLanguage);...
java
List<Language> getLanguages() throws IllegalAccessException, InstantiationException { List<Language> languages = new ArrayList<>(); for (File ruleFile : ruleFiles) { if (ruleFile != null) { Language newLanguage = LanguageBuilder.makeAdditionalLanguage(ruleFile); languages.add(newLanguage);...
[ "List", "<", "Language", ">", "getLanguages", "(", ")", "throws", "IllegalAccessException", ",", "InstantiationException", "{", "List", "<", "Language", ">", "languages", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "File", "ruleFile", ":", "rul...
Return all external Languages.
[ "Return", "all", "external", "Languages", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-standalone/src/main/java/org/languagetool/gui/LanguageManagerDialog.java#L196-L205
19,106
languagetool-org/languagetool
languagetool-wikipedia/src/main/java/org/languagetool/dev/wikipedia/SuggestionReplacer.java
SuggestionReplacer.applySuggestionsToOriginalText
public List<RuleMatchApplication> applySuggestionsToOriginalText(RuleMatch match) { List<String> replacements = new ArrayList<>(match.getSuggestedReplacements()); boolean hasRealReplacements = replacements.size() > 0; if (!hasRealReplacements) { // create a pseudo replacement with the error text itsel...
java
public List<RuleMatchApplication> applySuggestionsToOriginalText(RuleMatch match) { List<String> replacements = new ArrayList<>(match.getSuggestedReplacements()); boolean hasRealReplacements = replacements.size() > 0; if (!hasRealReplacements) { // create a pseudo replacement with the error text itsel...
[ "public", "List", "<", "RuleMatchApplication", ">", "applySuggestionsToOriginalText", "(", "RuleMatch", "match", ")", "{", "List", "<", "String", ">", "replacements", "=", "new", "ArrayList", "<>", "(", "match", ".", "getSuggestedReplacements", "(", ")", ")", ";...
Applies the suggestions from the rule to the original text. For rules that have no suggestion, a pseudo-correction is generated that contains the same text as before.
[ "Applies", "the", "suggestions", "from", "the", "rule", "to", "the", "original", "text", ".", "For", "rules", "that", "have", "no", "suggestion", "a", "pseudo", "-", "correction", "is", "generated", "that", "contains", "the", "same", "text", "as", "before", ...
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-wikipedia/src/main/java/org/languagetool/dev/wikipedia/SuggestionReplacer.java#L60-L125
19,107
languagetool-org/languagetool
languagetool-language-modules/en/src/main/java/org/languagetool/chunking/EnglishChunker.java
EnglishChunker.tokenize
String[] tokenize(String sentence) { TokenizerME tokenizer = new TokenizerME(tokenModel); String cleanString = sentence.replace('โ€™', '\''); // this is the type of apostrophe that OpenNLP expects return tokenizer.tokenize(cleanString); }
java
String[] tokenize(String sentence) { TokenizerME tokenizer = new TokenizerME(tokenModel); String cleanString = sentence.replace('โ€™', '\''); // this is the type of apostrophe that OpenNLP expects return tokenizer.tokenize(cleanString); }
[ "String", "[", "]", "tokenize", "(", "String", "sentence", ")", "{", "TokenizerME", "tokenizer", "=", "new", "TokenizerME", "(", "tokenModel", ")", ";", "String", "cleanString", "=", "sentence", ".", "replace", "(", "'", " ", "'", "'", ";", " ", " ", "...
non-private for test cases
[ "non", "-", "private", "for", "test", "cases" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/en/src/main/java/org/languagetool/chunking/EnglishChunker.java#L95-L99
19,108
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/XMLValidator.java
XMLValidator.checkSimpleXMLString
public void checkSimpleXMLString(String xml) throws IOException { Pattern pattern = Pattern.compile("(<error.*?/>)", Pattern.DOTALL|Pattern.MULTILINE); Matcher matcher = pattern.matcher(xml); int pos = 0; while (matcher.find(pos)) { String errorElement = matcher.group(); pos = matcher.end();...
java
public void checkSimpleXMLString(String xml) throws IOException { Pattern pattern = Pattern.compile("(<error.*?/>)", Pattern.DOTALL|Pattern.MULTILINE); Matcher matcher = pattern.matcher(xml); int pos = 0; while (matcher.find(pos)) { String errorElement = matcher.group(); pos = matcher.end();...
[ "public", "void", "checkSimpleXMLString", "(", "String", "xml", ")", "throws", "IOException", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "\"(<error.*?/>)\"", ",", "Pattern", ".", "DOTALL", "|", "Pattern", ".", "MULTILINE", ")", ";", "Match...
Check some limits of our simplified XML output.
[ "Check", "some", "limits", "of", "our", "simplified", "XML", "output", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/XMLValidator.java#L66-L81
19,109
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/XMLValidator.java
XMLValidator.validateXMLString
public void validateXMLString(String xml, String dtdFile, String docType) throws SAXException, IOException, ParserConfigurationException { validateInternal(xml, dtdFile, docType); }
java
public void validateXMLString(String xml, String dtdFile, String docType) throws SAXException, IOException, ParserConfigurationException { validateInternal(xml, dtdFile, docType); }
[ "public", "void", "validateXMLString", "(", "String", "xml", ",", "String", "dtdFile", ",", "String", "docType", ")", "throws", "SAXException", ",", "IOException", ",", "ParserConfigurationException", "{", "validateInternal", "(", "xml", ",", "dtdFile", ",", "docT...
Validate XML with the given DTD. Throws exception on error.
[ "Validate", "XML", "with", "the", "given", "DTD", ".", "Throws", "exception", "on", "error", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/XMLValidator.java#L86-L88
19,110
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/XMLValidator.java
XMLValidator.validateWithDtd
public void validateWithDtd(String filename, String dtdPath, String docType) throws IOException { try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) { if (xmlStream == null) { throw new IOException("Not found in classpath: " + filename); } try { String xml ...
java
public void validateWithDtd(String filename, String dtdPath, String docType) throws IOException { try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) { if (xmlStream == null) { throw new IOException("Not found in classpath: " + filename); } try { String xml ...
[ "public", "void", "validateWithDtd", "(", "String", "filename", ",", "String", "dtdPath", ",", "String", "docType", ")", "throws", "IOException", "{", "try", "(", "InputStream", "xmlStream", "=", "this", ".", "getClass", "(", ")", ".", "getResourceAsStream", "...
Validate XML file in classpath with the given DTD. Throws exception on error.
[ "Validate", "XML", "file", "in", "classpath", "with", "the", "given", "DTD", ".", "Throws", "exception", "on", "error", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/XMLValidator.java#L93-L105
19,111
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
JLanguageTool.activateNeuralNetworkRules
public void activateNeuralNetworkRules(File modelDir) throws IOException { ResourceBundle messages = getMessageBundle(language); List<Rule> rules = language.getRelevantNeuralNetworkModels(messages, modelDir); userRules.addAll(rules); }
java
public void activateNeuralNetworkRules(File modelDir) throws IOException { ResourceBundle messages = getMessageBundle(language); List<Rule> rules = language.getRelevantNeuralNetworkModels(messages, modelDir); userRules.addAll(rules); }
[ "public", "void", "activateNeuralNetworkRules", "(", "File", "modelDir", ")", "throws", "IOException", "{", "ResourceBundle", "messages", "=", "getMessageBundle", "(", "language", ")", ";", "List", "<", "Rule", ">", "rules", "=", "language", ".", "getRelevantNeura...
Activate rules that depend on pretrained neural network models. @param modelDir root dir of exported models @since 4.4
[ "Activate", "rules", "that", "depend", "on", "pretrained", "neural", "network", "models", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L471-L475
19,112
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
JLanguageTool.activateLanguageModelRules
public void activateLanguageModelRules(File indexDir) throws IOException { LanguageModel languageModel = language.getLanguageModel(indexDir); if (languageModel != null) { ResourceBundle messages = getMessageBundle(language); List<Rule> rules = language.getRelevantLanguageModelRules(messages, languag...
java
public void activateLanguageModelRules(File indexDir) throws IOException { LanguageModel languageModel = language.getLanguageModel(indexDir); if (languageModel != null) { ResourceBundle messages = getMessageBundle(language); List<Rule> rules = language.getRelevantLanguageModelRules(messages, languag...
[ "public", "void", "activateLanguageModelRules", "(", "File", "indexDir", ")", "throws", "IOException", "{", "LanguageModel", "languageModel", "=", "language", ".", "getLanguageModel", "(", "indexDir", ")", ";", "if", "(", "languageModel", "!=", "null", ")", "{", ...
Activate rules that depend on a language model. The language model currently consists of Lucene indexes with ngram occurrence counts. @param indexDir directory with a '3grams' sub directory which contains a Lucene index with 3gram occurrence counts @since 2.7
[ "Activate", "rules", "that", "depend", "on", "a", "language", "model", ".", "The", "language", "model", "currently", "consists", "of", "Lucene", "indexes", "with", "ngram", "occurrence", "counts", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L483-L491
19,113
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
JLanguageTool.activateWord2VecModelRules
public void activateWord2VecModelRules(File indexDir) throws IOException { Word2VecModel word2vecModel = language.getWord2VecModel(indexDir); if (word2vecModel != null) { ResourceBundle messages = getMessageBundle(language); List<Rule> rules = language.getRelevantWord2VecModelRules(messages, word2ve...
java
public void activateWord2VecModelRules(File indexDir) throws IOException { Word2VecModel word2vecModel = language.getWord2VecModel(indexDir); if (word2vecModel != null) { ResourceBundle messages = getMessageBundle(language); List<Rule> rules = language.getRelevantWord2VecModelRules(messages, word2ve...
[ "public", "void", "activateWord2VecModelRules", "(", "File", "indexDir", ")", "throws", "IOException", "{", "Word2VecModel", "word2vecModel", "=", "language", ".", "getWord2VecModel", "(", "indexDir", ")", ";", "if", "(", "word2vecModel", "!=", "null", ")", "{", ...
Activate rules that depend on a word2vec language model. @param indexDir directory with a subdirectories like 'en', each containing dictionary.txt and final_embeddings.txt @since 4.0
[ "Activate", "rules", "that", "depend", "on", "a", "word2vec", "language", "model", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L498-L505
19,114
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
JLanguageTool.adjustRuleMatchPos
public RuleMatch adjustRuleMatchPos(RuleMatch match, int charCount, int columnCount, int lineCount, String sentence, AnnotatedText annotatedText) { int fromPos = match.getFromPos() + charCount; int toPos = match.getToPos() + charCount; if (annotatedText != null) { fromPos = annotatedText.getOrig...
java
public RuleMatch adjustRuleMatchPos(RuleMatch match, int charCount, int columnCount, int lineCount, String sentence, AnnotatedText annotatedText) { int fromPos = match.getFromPos() + charCount; int toPos = match.getToPos() + charCount; if (annotatedText != null) { fromPos = annotatedText.getOrig...
[ "public", "RuleMatch", "adjustRuleMatchPos", "(", "RuleMatch", "match", ",", "int", "charCount", ",", "int", "columnCount", ",", "int", "lineCount", ",", "String", "sentence", ",", "AnnotatedText", "annotatedText", ")", "{", "int", "fromPos", "=", "match", ".", ...
Change RuleMatch positions so they are relative to the complete text, not just to the sentence. @param charCount Count of characters in the sentences before @param columnCount Current column number @param lineCount Current line number @param sentence The text being checked @return The RuleMatch object with adjustments
[ "Change", "RuleMatch", "positions", "so", "they", "are", "relative", "to", "the", "complete", "text", "not", "just", "to", "the", "sentence", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L851-L888
19,115
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
JLanguageTool.countLineBreaks
static int countLineBreaks(String s) { int pos = -1; int count = 0; while (true) { int nextPos = s.indexOf('\n', pos + 1); if (nextPos == -1) { break; } pos = nextPos; count++; } return count; }
java
static int countLineBreaks(String s) { int pos = -1; int count = 0; while (true) { int nextPos = s.indexOf('\n', pos + 1); if (nextPos == -1) { break; } pos = nextPos; count++; } return count; }
[ "static", "int", "countLineBreaks", "(", "String", "s", ")", "{", "int", "pos", "=", "-", "1", ";", "int", "count", "=", "0", ";", "while", "(", "true", ")", "{", "int", "nextPos", "=", "s", ".", "indexOf", "(", "'", "'", ",", "pos", "+", "1", ...
non-private only for test case
[ "non", "-", "private", "only", "for", "test", "case" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L928-L940
19,116
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
JLanguageTool.getCategories
public Map<CategoryId, Category> getCategories() { Map<CategoryId, Category> map = new HashMap<>(); for (Rule rule : getAllRules()) { map.put(rule.getCategory().getId(), rule.getCategory()); } return map; }
java
public Map<CategoryId, Category> getCategories() { Map<CategoryId, Category> map = new HashMap<>(); for (Rule rule : getAllRules()) { map.put(rule.getCategory().getId(), rule.getCategory()); } return map; }
[ "public", "Map", "<", "CategoryId", ",", "Category", ">", "getCategories", "(", ")", "{", "Map", "<", "CategoryId", ",", "Category", ">", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Rule", "rule", ":", "getAllRules", "(", ")", ")"...
Get all rule categories for the current language. @return a map of {@link Category Categories}, keyed by their {@link CategoryId id}. @since 3.5
[ "Get", "all", "rule", "categories", "for", "the", "current", "language", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L1044-L1050
19,117
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
JLanguageTool.getAllActiveOfficeRules
public List<Rule> getAllActiveOfficeRules() { List<Rule> rules = new ArrayList<>(); List<Rule> rulesActive = new ArrayList<>(); rules.addAll(builtinRules); rules.addAll(userRules); for (Rule rule : rules) { if (!ignoreRule(rule) && !rule.isOfficeDefaultOff()) { rulesActive.add(rule); ...
java
public List<Rule> getAllActiveOfficeRules() { List<Rule> rules = new ArrayList<>(); List<Rule> rulesActive = new ArrayList<>(); rules.addAll(builtinRules); rules.addAll(userRules); for (Rule rule : rules) { if (!ignoreRule(rule) && !rule.isOfficeDefaultOff()) { rulesActive.add(rule); ...
[ "public", "List", "<", "Rule", ">", "getAllActiveOfficeRules", "(", ")", "{", "List", "<", "Rule", ">", "rules", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "Rule", ">", "rulesActive", "=", "new", "ArrayList", "<>", "(", ")", ";", "rul...
Works like getAllActiveRules but overrides defaults by officeefaults @return a List of {@link Rule} objects @since 4.0
[ "Works", "like", "getAllActiveRules", "but", "overrides", "defaults", "by", "officeefaults" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L1095-L1111
19,118
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java
PatternRuleMatcher.matchPreservesCase
private boolean matchPreservesCase(List<Match> suggestionMatches, String msg) { if (suggestionMatches != null && !suggestionMatches.isEmpty()) { //PatternRule rule = (PatternRule) this.rule; int sugStart = msg.indexOf(SUGGESTION_START_TAG) + SUGGESTION_START_TAG.length(); for (Match sMatch : sugge...
java
private boolean matchPreservesCase(List<Match> suggestionMatches, String msg) { if (suggestionMatches != null && !suggestionMatches.isEmpty()) { //PatternRule rule = (PatternRule) this.rule; int sugStart = msg.indexOf(SUGGESTION_START_TAG) + SUGGESTION_START_TAG.length(); for (Match sMatch : sugge...
[ "private", "boolean", "matchPreservesCase", "(", "List", "<", "Match", ">", "suggestionMatches", ",", "String", "msg", ")", "{", "if", "(", "suggestionMatches", "!=", "null", "&&", "!", "suggestionMatches", ".", "isEmpty", "(", ")", ")", "{", "//PatternRule ru...
Checks if the suggestion starts with a match that is supposed to preserve case. If it does not, perform the default conversion to uppercase. @return true, if the match preserves the case of the token.
[ "Checks", "if", "the", "suggestion", "starts", "with", "a", "match", "that", "is", "supposed", "to", "preserve", "case", ".", "If", "it", "does", "not", "perform", "the", "default", "conversion", "to", "uppercase", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java#L261-L273
19,119
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java
PatternRuleMatcher.translateElementNo
private int translateElementNo(int i) { if (!useList || i < 0) { return i; } int j = 0; PatternRule rule = (PatternRule) this.rule; for (int k = 0; k < i; k++) { j += rule.getElementNo().get(k); } return j; }
java
private int translateElementNo(int i) { if (!useList || i < 0) { return i; } int j = 0; PatternRule rule = (PatternRule) this.rule; for (int k = 0; k < i; k++) { j += rule.getElementNo().get(k); } return j; }
[ "private", "int", "translateElementNo", "(", "int", "i", ")", "{", "if", "(", "!", "useList", "||", "i", "<", "0", ")", "{", "return", "i", ";", "}", "int", "j", "=", "0", ";", "PatternRule", "rule", "=", "(", "PatternRule", ")", "this", ".", "ru...
Gets the index of the element indexed by i, adding any offsets because of the phrases in the rule. @param i Current element index. @return int Index translated into XML element no.
[ "Gets", "the", "index", "of", "the", "element", "indexed", "by", "i", "adding", "any", "offsets", "because", "of", "the", "phrases", "in", "the", "rule", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java#L281-L291
19,120
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java
PatternRuleMatcher.combineLists
private static String[] combineLists(String[][] input, String[] output, int r, Language lang) { List<String> outputList = new ArrayList<>(); if (r == input.length) { StringBuilder sb = new StringBuilder(); for (int k = 0; k < output.length; k++) { sb.append(output[k]); if (k < ...
java
private static String[] combineLists(String[][] input, String[] output, int r, Language lang) { List<String> outputList = new ArrayList<>(); if (r == input.length) { StringBuilder sb = new StringBuilder(); for (int k = 0; k < output.length; k++) { sb.append(output[k]); if (k < ...
[ "private", "static", "String", "[", "]", "combineLists", "(", "String", "[", "]", "[", "]", "input", ",", "String", "[", "]", "output", ",", "int", "r", ",", "Language", "lang", ")", "{", "List", "<", "String", ">", "outputList", "=", "new", "ArrayLi...
Creates a Cartesian product of the arrays stored in the input array. @param input Array of string arrays to combine. @param output Work array of strings. @param r Starting parameter (use 0 to get all combinations). @param lang Text language for adding spaces in some languages. @return Combined array of String.
[ "Creates", "a", "Cartesian", "product", "of", "the", "arrays", "stored", "in", "the", "input", "array", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java#L502-L522
19,121
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/ConfigurationDialog.java
ConfigurationDialog.getLanguageForLocalizedName
@Nullable private Language getLanguageForLocalizedName(String languageName) { for (Language element : Languages.get()) { if (languageName.equals(element.getTranslatedName(messages))) { return element; } } return null; }
java
@Nullable private Language getLanguageForLocalizedName(String languageName) { for (Language element : Languages.get()) { if (languageName.equals(element.getTranslatedName(messages))) { return element; } } return null; }
[ "@", "Nullable", "private", "Language", "getLanguageForLocalizedName", "(", "String", "languageName", ")", "{", "for", "(", "Language", "element", ":", "Languages", ".", "get", "(", ")", ")", "{", "if", "(", "languageName", ".", "equals", "(", "element", "."...
Get the Language object for the given localized language name. @param languageName e.g. <code>English</code> or <code>German</code> (case is significant) @return a Language object or <code>null</code> if the language could not be found
[ "Get", "the", "Language", "object", "for", "the", "given", "localized", "language", "name", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/ConfigurationDialog.java#L984-L992
19,122
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java
LinguisticServices.GetLinguSvcMgr
private XLinguServiceManager GetLinguSvcMgr(XComponentContext xContext) { try { XMultiComponentFactory xMCF = UnoRuntime.queryInterface(XMultiComponentFactory.class, xContext.getServiceManager()); if (xMCF == null) { printText("XMultiComponentFactory == null"); return null; ...
java
private XLinguServiceManager GetLinguSvcMgr(XComponentContext xContext) { try { XMultiComponentFactory xMCF = UnoRuntime.queryInterface(XMultiComponentFactory.class, xContext.getServiceManager()); if (xMCF == null) { printText("XMultiComponentFactory == null"); return null; ...
[ "private", "XLinguServiceManager", "GetLinguSvcMgr", "(", "XComponentContext", "xContext", ")", "{", "try", "{", "XMultiComponentFactory", "xMCF", "=", "UnoRuntime", ".", "queryInterface", "(", "XMultiComponentFactory", ".", "class", ",", "xContext", ".", "getServiceMan...
Get the LinguServiceManager to be used for example to access spell checker, thesaurus and hyphenator
[ "Get", "the", "LinguServiceManager", "to", "be", "used", "for", "example", "to", "access", "spell", "checker", "thesaurus", "and", "hyphenator" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java#L62-L97
19,123
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java
LinguisticServices.GetThesaurus
private XThesaurus GetThesaurus(XLinguServiceManager mxLinguSvcMgr) { try { if (mxLinguSvcMgr != null) { return mxLinguSvcMgr.getThesaurus(); } } catch (Throwable t) { // If anything goes wrong, give the user a stack trace printMessage(t); } return null; }
java
private XThesaurus GetThesaurus(XLinguServiceManager mxLinguSvcMgr) { try { if (mxLinguSvcMgr != null) { return mxLinguSvcMgr.getThesaurus(); } } catch (Throwable t) { // If anything goes wrong, give the user a stack trace printMessage(t); } return null; }
[ "private", "XThesaurus", "GetThesaurus", "(", "XLinguServiceManager", "mxLinguSvcMgr", ")", "{", "try", "{", "if", "(", "mxLinguSvcMgr", "!=", "null", ")", "{", "return", "mxLinguSvcMgr", ".", "getThesaurus", "(", ")", ";", "}", "}", "catch", "(", "Throwable",...
Get the Thesaurus to be used.
[ "Get", "the", "Thesaurus", "to", "be", "used", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java#L102-L112
19,124
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java
LinguisticServices.GetHyphenator
private XHyphenator GetHyphenator(XLinguServiceManager mxLinguSvcMgr) { try { if (mxLinguSvcMgr != null) { return mxLinguSvcMgr.getHyphenator(); } } catch (Throwable t) { // If anything goes wrong, give the user a stack trace printMessage(t); } return null; }
java
private XHyphenator GetHyphenator(XLinguServiceManager mxLinguSvcMgr) { try { if (mxLinguSvcMgr != null) { return mxLinguSvcMgr.getHyphenator(); } } catch (Throwable t) { // If anything goes wrong, give the user a stack trace printMessage(t); } return null; }
[ "private", "XHyphenator", "GetHyphenator", "(", "XLinguServiceManager", "mxLinguSvcMgr", ")", "{", "try", "{", "if", "(", "mxLinguSvcMgr", "!=", "null", ")", "{", "return", "mxLinguSvcMgr", ".", "getHyphenator", "(", ")", ";", "}", "}", "catch", "(", "Throwabl...
Get the Hyphenator to be used.
[ "Get", "the", "Hyphenator", "to", "be", "used", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java#L117-L127
19,125
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java
LinguisticServices.GetSpellChecker
private XSpellChecker GetSpellChecker(XLinguServiceManager mxLinguSvcMgr) { try { if (mxLinguSvcMgr != null) { return mxLinguSvcMgr.getSpellChecker(); } } catch (Throwable t) { // If anything goes wrong, give the user a stack trace printMessage(t); } return null; }
java
private XSpellChecker GetSpellChecker(XLinguServiceManager mxLinguSvcMgr) { try { if (mxLinguSvcMgr != null) { return mxLinguSvcMgr.getSpellChecker(); } } catch (Throwable t) { // If anything goes wrong, give the user a stack trace printMessage(t); } return null; }
[ "private", "XSpellChecker", "GetSpellChecker", "(", "XLinguServiceManager", "mxLinguSvcMgr", ")", "{", "try", "{", "if", "(", "mxLinguSvcMgr", "!=", "null", ")", "{", "return", "mxLinguSvcMgr", ".", "getSpellChecker", "(", ")", ";", "}", "}", "catch", "(", "Th...
Get the SpellChecker to be used.
[ "Get", "the", "SpellChecker", "to", "be", "used", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java#L132-L142
19,126
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java
LinguisticServices.getSynonyms
@Override public List<String> getSynonyms(String word, Language lang) { return getSynonyms(word, getLocale(lang)); }
java
@Override public List<String> getSynonyms(String word, Language lang) { return getSynonyms(word, getLocale(lang)); }
[ "@", "Override", "public", "List", "<", "String", ">", "getSynonyms", "(", "String", "word", ",", "Language", "lang", ")", "{", "return", "getSynonyms", "(", "word", ",", "getLocale", "(", "lang", ")", ")", ";", "}" ]
Get all synonyms of a word as list of strings.
[ "Get", "all", "synonyms", "of", "a", "word", "as", "list", "of", "strings", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java#L167-L170
19,127
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java
LinguisticServices.isCorrectSpell
@Override public boolean isCorrectSpell(String word, Language lang) { return isCorrectSpell(word, getLocale(lang)); }
java
@Override public boolean isCorrectSpell(String word, Language lang) { return isCorrectSpell(word, getLocale(lang)); }
[ "@", "Override", "public", "boolean", "isCorrectSpell", "(", "String", "word", ",", "Language", "lang", ")", "{", "return", "isCorrectSpell", "(", "word", ",", "getLocale", "(", "lang", ")", ")", ";", "}" ]
Returns true if the spell check is positive
[ "Returns", "true", "if", "the", "spell", "check", "is", "positive" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java#L202-L205
19,128
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java
LinguisticServices.getNumberOfSyllables
@Override public int getNumberOfSyllables(String word, Language lang) { return getNumberOfSyllables(word, getLocale(lang)); }
java
@Override public int getNumberOfSyllables(String word, Language lang) { return getNumberOfSyllables(word, getLocale(lang)); }
[ "@", "Override", "public", "int", "getNumberOfSyllables", "(", "String", "word", ",", "Language", "lang", ")", "{", "return", "getNumberOfSyllables", "(", "word", ",", "getLocale", "(", "lang", ")", ")", ";", "}" ]
Returns the number of syllable of a word Returns -1 if the word was not found or anything goes wrong
[ "Returns", "the", "number", "of", "syllable", "of", "a", "word", "Returns", "-", "1", "if", "the", "word", "was", "not", "found", "or", "anything", "goes", "wrong" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java#L222-L225
19,129
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/morfologik/MorfologikMultiSpeller.java
MorfologikMultiSpeller.isMisspelled
public boolean isMisspelled(String word) { for (MorfologikSpeller speller : spellers) { if (!speller.isMisspelled(word)) { return false; } } return true; }
java
public boolean isMisspelled(String word) { for (MorfologikSpeller speller : spellers) { if (!speller.isMisspelled(word)) { return false; } } return true; }
[ "public", "boolean", "isMisspelled", "(", "String", "word", ")", "{", "for", "(", "MorfologikSpeller", "speller", ":", "spellers", ")", "{", "if", "(", "!", "speller", ".", "isMisspelled", "(", "word", ")", ")", "{", "return", "false", ";", "}", "}", "...
Accept the word if at least one of the dictionaries accepts it as not misspelled.
[ "Accept", "the", "word", "if", "at", "least", "one", "of", "the", "dictionaries", "accepts", "it", "as", "not", "misspelled", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/morfologik/MorfologikMultiSpeller.java#L199-L206
19,130
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java
MatchState.setToken
public final void setToken(AnalyzedTokenReadings[] tokens, int index, int next) { int idx = index; if (index >= tokens.length) { // TODO: hacky workaround, find a proper solution. See EnglishPatternRuleTest.testBug() idx = tokens.length - 1; } setToken(tokens[idx]); IncludeRange includeS...
java
public final void setToken(AnalyzedTokenReadings[] tokens, int index, int next) { int idx = index; if (index >= tokens.length) { // TODO: hacky workaround, find a proper solution. See EnglishPatternRuleTest.testBug() idx = tokens.length - 1; } setToken(tokens[idx]); IncludeRange includeS...
[ "public", "final", "void", "setToken", "(", "AnalyzedTokenReadings", "[", "]", "tokens", ",", "int", "index", ",", "int", "next", ")", "{", "int", "idx", "=", "index", ";", "if", "(", "index", ">=", "tokens", ".", "length", ")", "{", "// TODO: hacky work...
Sets the token to be formatted etc. and includes the support for including the skipped tokens. @param tokens Array of tokens @param index Index of the token to be formatted @param next Position of the next token (the skipped tokens are the ones between the tokens[index] and tokens[next]
[ "Sets", "the", "token", "to", "be", "formatted", "etc", ".", "and", "includes", "the", "support", "for", "including", "the", "skipped", "tokens", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java#L81-L105
19,131
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java
MatchState.getTargetPosTag
public final String getTargetPosTag() { String targetPosTag = match.getPosTag(); List<String> posTags = new ArrayList<>(); Pattern pPosRegexMatch = match.getPosRegexMatch(); String posTagReplace = match.getPosTagReplace(); if (match.isStaticLemma()) { for (AnalyzedToken analyzedToken : matche...
java
public final String getTargetPosTag() { String targetPosTag = match.getPosTag(); List<String> posTags = new ArrayList<>(); Pattern pPosRegexMatch = match.getPosRegexMatch(); String posTagReplace = match.getPosTagReplace(); if (match.isStaticLemma()) { for (AnalyzedToken analyzedToken : matche...
[ "public", "final", "String", "getTargetPosTag", "(", ")", "{", "String", "targetPosTag", "=", "match", ".", "getPosTag", "(", ")", ";", "List", "<", "String", ">", "posTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "Pattern", "pPosRegexMatch", "=", ...
on the other hand, many POS tags = too many suggestions?
[ "on", "the", "other", "hand", "many", "POS", "tags", "=", "too", "many", "suggestions?" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java#L323-L372
19,132
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java
MatchState.toTokenString
final String toTokenString() throws IOException { String[] stringToFormat = toFinalString(null); return String.join("|", Arrays.asList(stringToFormat)); }
java
final String toTokenString() throws IOException { String[] stringToFormat = toFinalString(null); return String.join("|", Arrays.asList(stringToFormat)); }
[ "final", "String", "toTokenString", "(", ")", "throws", "IOException", "{", "String", "[", "]", "stringToFormat", "=", "toFinalString", "(", "null", ")", ";", "return", "String", ".", "join", "(", "\"|\"", ",", "Arrays", ".", "asList", "(", "stringToFormat",...
Method for getting the formatted match as a single string. In case of multiple matches, it joins them using a regular expression operator "|". @return Formatted string of the matched token.
[ "Method", "for", "getting", "the", "formatted", "match", "as", "a", "single", "string", ".", "In", "case", "of", "multiple", "matches", "it", "joins", "them", "using", "a", "regular", "expression", "operator", "|", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java#L379-L382
19,133
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java
SingleDocument.getCheckResults
ProofreadingResult getCheckResults(String paraText, Locale locale, ProofreadingResult paRes, int[] footnotePositions, boolean isParallelThread, JLanguageTool langTool) { try { SingleProofreadingError[] sErrors = null; paraNum = getParaPos(paraText, isParallelThread); // Don't use Cache for ...
java
ProofreadingResult getCheckResults(String paraText, Locale locale, ProofreadingResult paRes, int[] footnotePositions, boolean isParallelThread, JLanguageTool langTool) { try { SingleProofreadingError[] sErrors = null; paraNum = getParaPos(paraText, isParallelThread); // Don't use Cache for ...
[ "ProofreadingResult", "getCheckResults", "(", "String", "paraText", ",", "Locale", "locale", ",", "ProofreadingResult", "paRes", ",", "int", "[", "]", "footnotePositions", ",", "boolean", "isParallelThread", ",", "JLanguageTool", "langTool", ")", "{", "try", "{", ...
get the result for a check of a single document @param paraText paragraph text @param paRes proof reading result @param footnotePositions position of footnotes @param isParallelThread true: check runs as parallel thread @return proof reading result
[ "get", "the", "result", "for", "a", "check", "of", "a", "single", "document" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java#L120-L159
19,134
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java
SingleDocument.setConfigValues
void setConfigValues(Configuration config) { this.config = config; numParasToCheck = config.getNumParasToCheck(); defaultParaCheck = numParasToCheck * PARA_CHECK_FACTOR; doResetCheck = config.isResetCheck(); }
java
void setConfigValues(Configuration config) { this.config = config; numParasToCheck = config.getNumParasToCheck(); defaultParaCheck = numParasToCheck * PARA_CHECK_FACTOR; doResetCheck = config.isResetCheck(); }
[ "void", "setConfigValues", "(", "Configuration", "config", ")", "{", "this", ".", "config", "=", "config", ";", "numParasToCheck", "=", "config", ".", "getNumParasToCheck", "(", ")", ";", "defaultParaCheck", "=", "numParasToCheck", "*", "PARA_CHECK_FACTOR", ";", ...
set values set by configuration dialog
[ "set", "values", "set", "by", "configuration", "dialog" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java#L164-L169
19,135
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java
SingleDocument.optimizeReset
void optimizeReset() { FlatParagraphTools flatPara = new FlatParagraphTools(xContext); flatPara.markFlatParasAsChecked(resetFrom + divNum, resetTo + divNum, isChecked); resetCheck = false; }
java
void optimizeReset() { FlatParagraphTools flatPara = new FlatParagraphTools(xContext); flatPara.markFlatParasAsChecked(resetFrom + divNum, resetTo + divNum, isChecked); resetCheck = false; }
[ "void", "optimizeReset", "(", ")", "{", "FlatParagraphTools", "flatPara", "=", "new", "FlatParagraphTools", "(", "xContext", ")", ";", "flatPara", ".", "markFlatParasAsChecked", "(", "resetFrom", "+", "divNum", ",", "resetTo", "+", "divNum", ",", "isChecked", ")...
Reset only changed paragraphs
[ "Reset", "only", "changed", "paragraphs" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java#L220-L224
19,136
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java
SingleDocument.loadIsChecked
public void loadIsChecked () { FlatParagraphTools flatPara = new FlatParagraphTools(xContext); isChecked = flatPara.isChecked(); if (debugMode > 0) { int nChecked = 0; for (boolean bChecked : isChecked) { if(bChecked) { nChecked++; } } MessageHandler.printTo...
java
public void loadIsChecked () { FlatParagraphTools flatPara = new FlatParagraphTools(xContext); isChecked = flatPara.isChecked(); if (debugMode > 0) { int nChecked = 0; for (boolean bChecked : isChecked) { if(bChecked) { nChecked++; } } MessageHandler.printTo...
[ "public", "void", "loadIsChecked", "(", ")", "{", "FlatParagraphTools", "flatPara", "=", "new", "FlatParagraphTools", "(", "xContext", ")", ";", "isChecked", "=", "flatPara", ".", "isChecked", "(", ")", ";", "if", "(", "debugMode", ">", "0", ")", "{", "int...
load checked status of all paragraphs
[ "load", "checked", "status", "of", "all", "paragraphs" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java#L229-L242
19,137
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java
SingleDocument.getDocAsString
private String getDocAsString(int numCurPara) { if (numCurPara < 0 || allParas == null || allParas.size() < numCurPara - 1) { return ""; } int startPos; int endPos; if (numParasToCheck < 1) { startPos = 0; endPos = allParas.size(); } else { startPos = numCurPara - numPara...
java
private String getDocAsString(int numCurPara) { if (numCurPara < 0 || allParas == null || allParas.size() < numCurPara - 1) { return ""; } int startPos; int endPos; if (numParasToCheck < 1) { startPos = 0; endPos = allParas.size(); } else { startPos = numCurPara - numPara...
[ "private", "String", "getDocAsString", "(", "int", "numCurPara", ")", "{", "if", "(", "numCurPara", "<", "0", "||", "allParas", "==", "null", "||", "allParas", ".", "size", "(", ")", "<", "numCurPara", "-", "1", ")", "{", "return", "\"\"", ";", "}", ...
Gives Back the full Text as String
[ "Gives", "Back", "the", "full", "Text", "as", "String" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java#L468-L500
19,138
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java
SingleDocument.getStartOfParagraph
private int getStartOfParagraph(int nPara, int checkedPara) { if (allParas != null && nPara >= 0 && nPara < allParas.size()) { int startPos; if (numParasToCheck < 1) { startPos = 0; } else { startPos = checkedPara - numParasToCheck; if(textIsChanged && doResetCheck) { ...
java
private int getStartOfParagraph(int nPara, int checkedPara) { if (allParas != null && nPara >= 0 && nPara < allParas.size()) { int startPos; if (numParasToCheck < 1) { startPos = 0; } else { startPos = checkedPara - numParasToCheck; if(textIsChanged && doResetCheck) { ...
[ "private", "int", "getStartOfParagraph", "(", "int", "nPara", ",", "int", "checkedPara", ")", "{", "if", "(", "allParas", "!=", "null", "&&", "nPara", ">=", "0", "&&", "nPara", "<", "allParas", ".", "size", "(", ")", ")", "{", "int", "startPos", ";", ...
Gives Back the StartPosition of Paragraph
[ "Gives", "Back", "the", "StartPosition", "of", "Paragraph" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/SingleDocument.java#L505-L524
19,139
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/SimpleReplaceDataLoader.java
SimpleReplaceDataLoader.loadWords
public Map<String, List<String>> loadWords(String path) { InputStream stream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path); Map<String, List<String>> map = new HashMap<>(); try (Scanner scanner = new Scanner(stream, "utf-8")) { while (scanner.hasNextLine()) { String line = scan...
java
public Map<String, List<String>> loadWords(String path) { InputStream stream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path); Map<String, List<String>> map = new HashMap<>(); try (Scanner scanner = new Scanner(stream, "utf-8")) { while (scanner.hasNextLine()) { String line = scan...
[ "public", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "loadWords", "(", "String", "path", ")", "{", "InputStream", "stream", "=", "JLanguageTool", ".", "getDataBroker", "(", ")", ".", "getFromRulesDirAsStream", "(", "path", ")", ";", "Map",...
Load replacement rules from a utf-8 file in the classpath.
[ "Load", "replacement", "rules", "from", "a", "utf", "-", "8", "file", "in", "the", "classpath", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/SimpleReplaceDataLoader.java#L38-L60
19,140
languagetool-org/languagetool
languagetool-language-modules/ca/src/main/java/org/languagetool/rules/ca/ReflexiveVerbsRule.java
ReflexiveVerbsRule.matchLemmaRegexp
private boolean matchLemmaRegexp(AnalyzedTokenReadings aToken, Pattern pattern) { boolean matches = false; for (AnalyzedToken analyzedToken : aToken) { final String posTag = analyzedToken.getLemma(); if (posTag != null) { final Matcher m = pattern.matcher(posTag); if (m.matches...
java
private boolean matchLemmaRegexp(AnalyzedTokenReadings aToken, Pattern pattern) { boolean matches = false; for (AnalyzedToken analyzedToken : aToken) { final String posTag = analyzedToken.getLemma(); if (posTag != null) { final Matcher m = pattern.matcher(posTag); if (m.matches...
[ "private", "boolean", "matchLemmaRegexp", "(", "AnalyzedTokenReadings", "aToken", ",", "Pattern", "pattern", ")", "{", "boolean", "matches", "=", "false", ";", "for", "(", "AnalyzedToken", "analyzedToken", ":", "aToken", ")", "{", "final", "String", "posTag", "=...
Match lemma with regular expression
[ "Match", "lemma", "with", "regular", "expression" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/ca/src/main/java/org/languagetool/rules/ca/ReflexiveVerbsRule.java#L476-L490
19,141
languagetool-org/languagetool
languagetool-language-modules/ca/src/main/java/org/languagetool/rules/ca/ReflexiveVerbsRule.java
ReflexiveVerbsRule.matchLemmaList
private boolean matchLemmaList(AnalyzedTokenReadings aToken, List<String> list) { boolean matches = false; for (AnalyzedToken analyzedToken : aToken) { if (list.contains(analyzedToken.getLemma())) { matches = true; break; } } return matches; }
java
private boolean matchLemmaList(AnalyzedTokenReadings aToken, List<String> list) { boolean matches = false; for (AnalyzedToken analyzedToken : aToken) { if (list.contains(analyzedToken.getLemma())) { matches = true; break; } } return matches; }
[ "private", "boolean", "matchLemmaList", "(", "AnalyzedTokenReadings", "aToken", ",", "List", "<", "String", ">", "list", ")", "{", "boolean", "matches", "=", "false", ";", "for", "(", "AnalyzedToken", "analyzedToken", ":", "aToken", ")", "{", "if", "(", "lis...
Match lemma with String list
[ "Match", "lemma", "with", "String", "list" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/ca/src/main/java/org/languagetool/rules/ca/ReflexiveVerbsRule.java#L495-L505
19,142
languagetool-org/languagetool
languagetool-language-modules/ca/src/main/java/org/languagetool/rules/ca/ReflexiveVerbsRule.java
ReflexiveVerbsRule.matchRegexp
private boolean matchRegexp(String s, Pattern pattern) { final Matcher m = pattern.matcher(s); return m.matches(); }
java
private boolean matchRegexp(String s, Pattern pattern) { final Matcher m = pattern.matcher(s); return m.matches(); }
[ "private", "boolean", "matchRegexp", "(", "String", "s", ",", "Pattern", "pattern", ")", "{", "final", "Matcher", "m", "=", "pattern", ".", "matcher", "(", "s", ")", ";", "return", "m", ".", "matches", "(", ")", ";", "}" ]
Match String with regular expression
[ "Match", "String", "with", "regular", "expression" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/ca/src/main/java/org/languagetool/rules/ca/ReflexiveVerbsRule.java#L510-L513
19,143
languagetool-org/languagetool
languagetool-language-modules/ca/src/main/java/org/languagetool/rules/ca/ReflexiveVerbsRule.java
ReflexiveVerbsRule.isTherePronoun
private boolean isTherePronoun(final AnalyzedTokenReadings[] tokens, int i, Pattern lemma, Pattern postag) { int j = 1; boolean keepCounting = true; while (i - j > 0 && keepCounting) { if (matchPostagRegexp(tokens[i - j], postag) && matchLemmaRegexp(tokens[i - j], lemma)) retur...
java
private boolean isTherePronoun(final AnalyzedTokenReadings[] tokens, int i, Pattern lemma, Pattern postag) { int j = 1; boolean keepCounting = true; while (i - j > 0 && keepCounting) { if (matchPostagRegexp(tokens[i - j], postag) && matchLemmaRegexp(tokens[i - j], lemma)) retur...
[ "private", "boolean", "isTherePronoun", "(", "final", "AnalyzedTokenReadings", "[", "]", "tokens", ",", "int", "i", ",", "Pattern", "lemma", ",", "Pattern", "postag", ")", "{", "int", "j", "=", "1", ";", "boolean", "keepCounting", "=", "true", ";", "while"...
Checks if there is a desired pronoun near the verb
[ "Checks", "if", "there", "is", "a", "desired", "pronoun", "near", "the", "verb" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/ca/src/main/java/org/languagetool/rules/ca/ReflexiveVerbsRule.java#L678-L699
19,144
languagetool-org/languagetool
languagetool-server/src/main/java/org/languagetool/server/Server.java
Server.stop
public void stop() { if (httpHandler != null) { httpHandler.shutdown(); } if (server != null) { ServerTools.print("Stopping server..."); server.stop(5); isRunning = false; ServerTools.print("Server stopped"); } }
java
public void stop() { if (httpHandler != null) { httpHandler.shutdown(); } if (server != null) { ServerTools.print("Stopping server..."); server.stop(5); isRunning = false; ServerTools.print("Server stopped"); } }
[ "public", "void", "stop", "(", ")", "{", "if", "(", "httpHandler", "!=", "null", ")", "{", "httpHandler", ".", "shutdown", "(", ")", ";", "}", "if", "(", "server", "!=", "null", ")", "{", "ServerTools", ".", "print", "(", "\"Stopping server...\"", ")",...
Stop the server. Once stopped, a server cannot be used again.
[ "Stop", "the", "server", ".", "Once", "stopped", "a", "server", "cannot", "be", "used", "again", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/Server.java#L73-L83
19,145
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/WrongWordInContextRule.java
WrongWordInContextRule.loadContextWords
private static List<ContextWords> loadContextWords(String path) { List<ContextWords> set = new ArrayList<>(); InputStream stream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path); try (Scanner scanner = new Scanner(stream, "utf-8")) { while (scanner.hasNextLine()) { String line = s...
java
private static List<ContextWords> loadContextWords(String path) { List<ContextWords> set = new ArrayList<>(); InputStream stream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path); try (Scanner scanner = new Scanner(stream, "utf-8")) { while (scanner.hasNextLine()) { String line = s...
[ "private", "static", "List", "<", "ContextWords", ">", "loadContextWords", "(", "String", "path", ")", "{", "List", "<", "ContextWords", ">", "set", "=", "new", "ArrayList", "<>", "(", ")", ";", "InputStream", "stream", "=", "JLanguageTool", ".", "getDataBro...
Load words, contexts, and explanations.
[ "Load", "words", "contexts", "and", "explanations", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/WrongWordInContextRule.java#L224-L253
19,146
languagetool-org/languagetool
languagetool-commandline/src/main/java/org/languagetool/commandline/Main.java
Main.getFilteredText
private String getFilteredText(String filename, String encoding, boolean xmlFiltering) throws IOException { if (options.isVerbose()) { lt.setOutput(System.err); } // don't use StringTools.readStream() as that might add newlines which aren't there: try (InputStreamReader reader = getInputStreamRead...
java
private String getFilteredText(String filename, String encoding, boolean xmlFiltering) throws IOException { if (options.isVerbose()) { lt.setOutput(System.err); } // don't use StringTools.readStream() as that might add newlines which aren't there: try (InputStreamReader reader = getInputStreamRead...
[ "private", "String", "getFilteredText", "(", "String", "filename", ",", "String", "encoding", ",", "boolean", "xmlFiltering", ")", "throws", "IOException", "{", "if", "(", "options", ".", "isVerbose", "(", ")", ")", "{", "lt", ".", "setOutput", "(", "System"...
Loads filename and filters out XML. Note that the XML filtering can lead to incorrect positions in the list of matching rules.
[ "Loads", "filename", "and", "filters", "out", "XML", ".", "Note", "that", "the", "XML", "filtering", "can", "lead", "to", "incorrect", "positions", "in", "the", "list", "of", "matching", "rules", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-commandline/src/main/java/org/languagetool/commandline/Main.java#L342-L355
19,147
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java
Main.doProofreading
@Override public final ProofreadingResult doProofreading(String docID, String paraText, Locale locale, int startOfSentencePos, int nSuggestedBehindEndOfSentencePosition, PropertyValue[] propertyValues) { ProofreadingResult paRes = new ProofreadingResult(); paRes.nStartOfSentencePosition = st...
java
@Override public final ProofreadingResult doProofreading(String docID, String paraText, Locale locale, int startOfSentencePos, int nSuggestedBehindEndOfSentencePosition, PropertyValue[] propertyValues) { ProofreadingResult paRes = new ProofreadingResult(); paRes.nStartOfSentencePosition = st...
[ "@", "Override", "public", "final", "ProofreadingResult", "doProofreading", "(", "String", "docID", ",", "String", "paraText", ",", "Locale", "locale", ",", "int", "startOfSentencePos", ",", "int", "nSuggestedBehindEndOfSentencePosition", ",", "PropertyValue", "[", "]...
Runs the grammar checker on paragraph text. @param docID document ID @param paraText paragraph text @param locale Locale the text Locale @param startOfSentencePos start of sentence position @param nSuggestedBehindEndOfSentencePosition end of sentence position @return ProofreadingResult containing the results of the ch...
[ "Runs", "the", "grammar", "checker", "on", "paragraph", "text", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java#L134-L162
19,148
languagetool-org/languagetool
languagetool-standalone/src/main/java/org/languagetool/gui/UndoRedoSupport.java
UndoRedoSupport.endCompoundEdit
void endCompoundEdit() { if(!compoundMode) { throw new RuntimeException("not in compound mode"); } ce.end(); undoManager.addEdit(ce); ce = null; compoundMode = false; }
java
void endCompoundEdit() { if(!compoundMode) { throw new RuntimeException("not in compound mode"); } ce.end(); undoManager.addEdit(ce); ce = null; compoundMode = false; }
[ "void", "endCompoundEdit", "(", ")", "{", "if", "(", "!", "compoundMode", ")", "{", "throw", "new", "RuntimeException", "(", "\"not in compound mode\"", ")", ";", "}", "ce", ".", "end", "(", ")", ";", "undoManager", ".", "addEdit", "(", "ce", ")", ";", ...
Notify manager to stop merging undoable edits. Calling endCompoundEdit when not in compound mode is an error and will throw a RuntimeException. @since 2.7
[ "Notify", "manager", "to", "stop", "merging", "undoable", "edits", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-standalone/src/main/java/org/languagetool/gui/UndoRedoSupport.java#L109-L118
19,149
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/hunspell/Hunspell.java
Hunspell.getInstance
public static synchronized Hunspell getInstance(String libDir) throws UnsatisfiedLinkError, UnsupportedOperationException { if (hunspell != null) { return hunspell; } hunspell = new Hunspell(libDir); return hunspell; }
java
public static synchronized Hunspell getInstance(String libDir) throws UnsatisfiedLinkError, UnsupportedOperationException { if (hunspell != null) { return hunspell; } hunspell = new Hunspell(libDir); return hunspell; }
[ "public", "static", "synchronized", "Hunspell", "getInstance", "(", "String", "libDir", ")", "throws", "UnsatisfiedLinkError", ",", "UnsupportedOperationException", "{", "if", "(", "hunspell", "!=", "null", ")", "{", "return", "hunspell", ";", "}", "hunspell", "="...
The instance of the HunspellManager, looks for the native lib in the directory specified. @param libDir Optional absolute directory where the native lib can be found.
[ "The", "instance", "of", "the", "HunspellManager", "looks", "for", "the", "native", "lib", "in", "the", "directory", "specified", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/hunspell/Hunspell.java#L63-L70
19,150
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/hunspell/Hunspell.java
Hunspell.libName
public static String libName() throws UnsupportedOperationException { String os = System.getProperty("os.name").toLowerCase(); if (os.startsWith("windows")) { return libNameBare()+".dll"; } else if (os.startsWith("mac os x")) { // return libNameBare()+".dylib"; ...
java
public static String libName() throws UnsupportedOperationException { String os = System.getProperty("os.name").toLowerCase(); if (os.startsWith("windows")) { return libNameBare()+".dll"; } else if (os.startsWith("mac os x")) { // return libNameBare()+".dylib"; ...
[ "public", "static", "String", "libName", "(", ")", "throws", "UnsupportedOperationException", "{", "String", "os", "=", "System", ".", "getProperty", "(", "\"os.name\"", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "os", ".", "startsWith", "(", "\"wind...
Calculate the filename of the native hunspell lib. The files have completely different names to allow them to live in the same directory and avoid confusion.
[ "Calculate", "the", "filename", "of", "the", "native", "hunspell", "lib", ".", "The", "files", "have", "completely", "different", "names", "to", "allow", "them", "to", "live", "in", "the", "same", "directory", "and", "avoid", "confusion", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/hunspell/Hunspell.java#L140-L152
19,151
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/hunspell/Hunspell.java
Hunspell.getDictionary
public Dictionary getDictionary(String baseFileName) throws IOException { if (map.containsKey(baseFileName)) { return map.get(baseFileName); } else { Dictionary d = new Dictionary(baseFileName); map.put(baseFileName, d); return d; } ...
java
public Dictionary getDictionary(String baseFileName) throws IOException { if (map.containsKey(baseFileName)) { return map.get(baseFileName); } else { Dictionary d = new Dictionary(baseFileName); map.put(baseFileName, d); return d; } ...
[ "public", "Dictionary", "getDictionary", "(", "String", "baseFileName", ")", "throws", "IOException", "{", "if", "(", "map", ".", "containsKey", "(", "baseFileName", ")", ")", "{", "return", "map", ".", "get", "(", "baseFileName", ")", ";", "}", "else", "{...
Gets an instance of the dictionary. @param baseFileName the base name of the dictionary, passing /dict/da_DK means that the files /dict/da_DK.dic and /dict/da_DK.aff get loaded
[ "Gets", "an", "instance", "of", "the", "dictionary", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/hunspell/Hunspell.java#L233-L244
19,152
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/MultiWordChunker2.java
MultiWordChunker2.formatPosTag
protected String formatPosTag(String posTag, int position, int multiwordLength) { return tagFormat != null ? String.format(tagFormat, posTag) : posTag; }
java
protected String formatPosTag(String posTag, int position, int multiwordLength) { return tagFormat != null ? String.format(tagFormat, posTag) : posTag; }
[ "protected", "String", "formatPosTag", "(", "String", "posTag", ",", "int", "position", ",", "int", "multiwordLength", ")", "{", "return", "tagFormat", "!=", "null", "?", "String", ".", "format", "(", "tagFormat", ",", "posTag", ")", ":", "posTag", ";", "}...
Override this method if you want format POS tag differently @param posTag POS tag for the multiword @param position Position of the token in the multiword @return Returns formatted POS tag for the multiword
[ "Override", "this", "method", "if", "you", "want", "format", "POS", "tag", "differently" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/MultiWordChunker2.java#L89-L91
19,153
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tagging/BaseTagger.java
BaseTagger.addTokens
private void addTokens(List<AnalyzedToken> taggedTokens, List<AnalyzedToken> l) { if (taggedTokens != null) { for (AnalyzedToken at : taggedTokens) { l.add(at); } } }
java
private void addTokens(List<AnalyzedToken> taggedTokens, List<AnalyzedToken> l) { if (taggedTokens != null) { for (AnalyzedToken at : taggedTokens) { l.add(at); } } }
[ "private", "void", "addTokens", "(", "List", "<", "AnalyzedToken", ">", "taggedTokens", ",", "List", "<", "AnalyzedToken", ">", "l", ")", "{", "if", "(", "taggedTokens", "!=", "null", ")", "{", "for", "(", "AnalyzedToken", "at", ":", "taggedTokens", ")", ...
please do not make protected, this breaks other languages
[ "please", "do", "not", "make", "protected", "this", "breaks", "other", "languages" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tagging/BaseTagger.java#L222-L228
19,154
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java
Tools.openFileDialog
static File openFileDialog(Frame frame, FileFilter fileFilter, File initialDir) { return openFileDialog(frame, fileFilter, initialDir, JFileChooser.FILES_ONLY); }
java
static File openFileDialog(Frame frame, FileFilter fileFilter, File initialDir) { return openFileDialog(frame, fileFilter, initialDir, JFileChooser.FILES_ONLY); }
[ "static", "File", "openFileDialog", "(", "Frame", "frame", ",", "FileFilter", "fileFilter", ",", "File", "initialDir", ")", "{", "return", "openFileDialog", "(", "frame", ",", "fileFilter", ",", "initialDir", ",", "JFileChooser", ".", "FILES_ONLY", ")", ";", "...
Show a file chooser dialog in a specified directory @param frame Owner frame @param fileFilter The pattern of files to choose from @param initialDir The initial directory @return the selected file @since 2.6
[ "Show", "a", "file", "chooser", "dialog", "in", "a", "specified", "directory" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java#L69-L71
19,155
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java
Tools.openDirectoryDialog
static File openDirectoryDialog(Frame frame, File initialDir) { return openFileDialog(frame, null, initialDir, JFileChooser.DIRECTORIES_ONLY); }
java
static File openDirectoryDialog(Frame frame, File initialDir) { return openFileDialog(frame, null, initialDir, JFileChooser.DIRECTORIES_ONLY); }
[ "static", "File", "openDirectoryDialog", "(", "Frame", "frame", ",", "File", "initialDir", ")", "{", "return", "openFileDialog", "(", "frame", ",", "null", ",", "initialDir", ",", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "}" ]
Show a directory chooser dialog, starting with a specified directory @param frame Owner frame @param initialDir The initial directory @return the selected file @since 3.0
[ "Show", "a", "directory", "chooser", "dialog", "starting", "with", "a", "specified", "directory" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java#L80-L82
19,156
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java
Tools.getMnemonic
public static char getMnemonic(String label) { int mnemonicPos = label.indexOf('&'); while (mnemonicPos != -1 && mnemonicPos == label.indexOf("&&") && mnemonicPos < label.length()) { mnemonicPos = label.indexOf('&', mnemonicPos + 2); } if (mnemonicPos == -1 || mnemonicPos == label.leng...
java
public static char getMnemonic(String label) { int mnemonicPos = label.indexOf('&'); while (mnemonicPos != -1 && mnemonicPos == label.indexOf("&&") && mnemonicPos < label.length()) { mnemonicPos = label.indexOf('&', mnemonicPos + 2); } if (mnemonicPos == -1 || mnemonicPos == label.leng...
[ "public", "static", "char", "getMnemonic", "(", "String", "label", ")", "{", "int", "mnemonicPos", "=", "label", ".", "indexOf", "(", "'", "'", ")", ";", "while", "(", "mnemonicPos", "!=", "-", "1", "&&", "mnemonicPos", "==", "label", ".", "indexOf", "...
Returns mnemonic of a UI element. @param label String Label of the UI element @return Mnemonic of the UI element, or {@code \u0000} in case of no mnemonic set.
[ "Returns", "mnemonic", "of", "a", "UI", "element", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java#L165-L175
19,157
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java
Tools.centerDialog
public static void centerDialog(JDialog dialog) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = dialog.getSize(); dialog.setLocation(screenSize.width / 2 - frameSize.width / 2, screenSize.height / 2 - frameSize.height / 2); dialog.setLocationByPlat...
java
public static void centerDialog(JDialog dialog) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = dialog.getSize(); dialog.setLocation(screenSize.width / 2 - frameSize.width / 2, screenSize.height / 2 - frameSize.height / 2); dialog.setLocationByPlat...
[ "public", "static", "void", "centerDialog", "(", "JDialog", "dialog", ")", "{", "Dimension", "screenSize", "=", "Toolkit", ".", "getDefaultToolkit", "(", ")", ".", "getScreenSize", "(", ")", ";", "Dimension", "frameSize", "=", "dialog", ".", "getSize", "(", ...
Set dialog location to the center of the screen @param dialog the dialog which will be centered @since 2.6
[ "Set", "dialog", "location", "to", "the", "center", "of", "the", "screen" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java#L183-L189
19,158
languagetool-org/languagetool
languagetool-server/src/main/java/org/languagetool/server/DatabaseAccess.java
DatabaseAccess.executeStatement
static ResultSet executeStatement(SQL sql) throws SQLException { try (SqlSession session = sqlSessionFactory.openSession(true)) { try (Connection conn = session.getConnection()) { try (Statement stmt = conn.createStatement()) { return stmt.executeQuery(sql.toString()); } } ...
java
static ResultSet executeStatement(SQL sql) throws SQLException { try (SqlSession session = sqlSessionFactory.openSession(true)) { try (Connection conn = session.getConnection()) { try (Statement stmt = conn.createStatement()) { return stmt.executeQuery(sql.toString()); } } ...
[ "static", "ResultSet", "executeStatement", "(", "SQL", "sql", ")", "throws", "SQLException", "{", "try", "(", "SqlSession", "session", "=", "sqlSessionFactory", ".", "openSession", "(", "true", ")", ")", "{", "try", "(", "Connection", "conn", "=", "session", ...
For unit tests only
[ "For", "unit", "tests", "only" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/DatabaseAccess.java#L356-L364
19,159
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java
PatternToken.isExceptionMatched
public boolean isExceptionMatched(AnalyzedToken token) { if (exceptionSet) { for (PatternToken testException : exceptionList) { if (!testException.exceptionValidNext) { if (testException.isMatched(token)) { return true; } } } } return false; }
java
public boolean isExceptionMatched(AnalyzedToken token) { if (exceptionSet) { for (PatternToken testException : exceptionList) { if (!testException.exceptionValidNext) { if (testException.isMatched(token)) { return true; } } } } return false; }
[ "public", "boolean", "isExceptionMatched", "(", "AnalyzedToken", "token", ")", "{", "if", "(", "exceptionSet", ")", "{", "for", "(", "PatternToken", "testException", ":", "exceptionList", ")", "{", "if", "(", "!", "testException", ".", "exceptionValidNext", ")",...
Checks whether an exception matches. @param token AnalyzedToken to check matching against @return True if any of the exceptions matches (logical disjunction).
[ "Checks", "whether", "an", "exception", "matches", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java#L146-L157
19,160
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java
PatternToken.isAndExceptionGroupMatched
public boolean isAndExceptionGroupMatched(AnalyzedToken token) { for (PatternToken testAndGroup : andGroupList) { if (testAndGroup.isExceptionMatched(token)) { return true; } } return false; }
java
public boolean isAndExceptionGroupMatched(AnalyzedToken token) { for (PatternToken testAndGroup : andGroupList) { if (testAndGroup.isExceptionMatched(token)) { return true; } } return false; }
[ "public", "boolean", "isAndExceptionGroupMatched", "(", "AnalyzedToken", "token", ")", "{", "for", "(", "PatternToken", "testAndGroup", ":", "andGroupList", ")", "{", "if", "(", "testAndGroup", ".", "isExceptionMatched", "(", "token", ")", ")", "{", "return", "t...
Enables testing multiple conditions specified by multiple element exceptions. Works as logical AND operator. @param token the token checked for exceptions. @return true if all conditions are met, false otherwise.
[ "Enables", "testing", "multiple", "conditions", "specified", "by", "multiple", "element", "exceptions", ".", "Works", "as", "logical", "AND", "operator", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java#L165-L172
19,161
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java
PatternToken.isSentenceStart
public boolean isSentenceStart() { return posToken != null && JLanguageTool.SENTENCE_START_TAGNAME.equals(posToken.posTag) && !posToken.negation; }
java
public boolean isSentenceStart() { return posToken != null && JLanguageTool.SENTENCE_START_TAGNAME.equals(posToken.posTag) && !posToken.negation; }
[ "public", "boolean", "isSentenceStart", "(", ")", "{", "return", "posToken", "!=", "null", "&&", "JLanguageTool", ".", "SENTENCE_START_TAGNAME", ".", "equals", "(", "posToken", ".", "posTag", ")", "&&", "!", "posToken", ".", "negation", ";", "}" ]
Checks if the token is a sentence start. @return True if the element starts the sentence and the element hasn't been set to have negated POS token.
[ "Checks", "if", "the", "token", "is", "a", "sentence", "start", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java#L281-L283
19,162
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java
PatternToken.isPosTokenMatched
private boolean isPosTokenMatched(AnalyzedToken token) { if (posToken == null || posToken.posTag == null) { // if no POS set defaulting to true return true; } if (token.getPOSTag() == null) { return posToken.posUnknown && token.hasNoTag(); } boolean match; if (posToken.regExp) ...
java
private boolean isPosTokenMatched(AnalyzedToken token) { if (posToken == null || posToken.posTag == null) { // if no POS set defaulting to true return true; } if (token.getPOSTag() == null) { return posToken.posUnknown && token.hasNoTag(); } boolean match; if (posToken.regExp) ...
[ "private", "boolean", "isPosTokenMatched", "(", "AnalyzedToken", "token", ")", "{", "if", "(", "posToken", "==", "null", "||", "posToken", ".", "posTag", "==", "null", ")", "{", "// if no POS set defaulting to true", "return", "true", ";", "}", "if", "(", "tok...
Tests if part of speech matches a given string. Special value UNKNOWN_TAG matches null POS tags. @param token Token to test. @return true if matches
[ "Tests", "if", "part", "of", "speech", "matches", "a", "given", "string", ".", "Special", "value", "UNKNOWN_TAG", "matches", "null", "POS", "tags", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java#L367-L386
19,163
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java
PatternToken.isStringTokenMatched
private boolean isStringTokenMatched(AnalyzedToken token) { String testToken = getTestToken(token); if (stringRegExp) { Matcher m = pattern.matcher(new InterruptibleCharSequence(testToken)); return m.matches(); } if (caseSensitive) { return stringToken.equals(testToken); } retu...
java
private boolean isStringTokenMatched(AnalyzedToken token) { String testToken = getTestToken(token); if (stringRegExp) { Matcher m = pattern.matcher(new InterruptibleCharSequence(testToken)); return m.matches(); } if (caseSensitive) { return stringToken.equals(testToken); } retu...
[ "private", "boolean", "isStringTokenMatched", "(", "AnalyzedToken", "token", ")", "{", "String", "testToken", "=", "getTestToken", "(", "token", ")", ";", "if", "(", "stringRegExp", ")", "{", "Matcher", "m", "=", "pattern", ".", "matcher", "(", "new", "Inter...
Tests whether the string token element matches a given token. @param token {@link AnalyzedToken} to match against. @return True if matches.
[ "Tests", "whether", "the", "string", "token", "element", "matches", "a", "given", "token", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java#L393-L403
19,164
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java
PatternToken.setExceptionSpaceBefore
public void setExceptionSpaceBefore(boolean isWhite) { if (previousExceptionList != null && exceptionValidPrevious) { previousExceptionList.get(previousExceptionList.size() - 1).setWhitespaceBefore(isWhite); } else { if (exceptionList != null) { exceptionList.get(exceptionList.size() - 1).se...
java
public void setExceptionSpaceBefore(boolean isWhite) { if (previousExceptionList != null && exceptionValidPrevious) { previousExceptionList.get(previousExceptionList.size() - 1).setWhitespaceBefore(isWhite); } else { if (exceptionList != null) { exceptionList.get(exceptionList.size() - 1).se...
[ "public", "void", "setExceptionSpaceBefore", "(", "boolean", "isWhite", ")", "{", "if", "(", "previousExceptionList", "!=", "null", "&&", "exceptionValidPrevious", ")", "{", "previousExceptionList", ".", "get", "(", "previousExceptionList", ".", "size", "(", ")", ...
Sets the attribute on the exception that determines matching of patterns that depends on whether there was a space before the token matching the exception or not. The same procedure is used for tokens that are valid for previous or current tokens. @param isWhite If true, the space before exception is required.
[ "Sets", "the", "attribute", "on", "the", "exception", "that", "determines", "matching", "of", "patterns", "that", "depends", "on", "whether", "there", "was", "a", "space", "before", "the", "token", "matching", "the", "exception", "or", "not", ".", "The", "sa...
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternToken.java#L709-L717
19,165
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationPatternRule.java
DisambiguationPatternRule.replace
public final AnalyzedSentence replace(AnalyzedSentence sentence) throws IOException { DisambiguationPatternRuleReplacer replacer = new DisambiguationPatternRuleReplacer(this); return replacer.replace(sentence); }
java
public final AnalyzedSentence replace(AnalyzedSentence sentence) throws IOException { DisambiguationPatternRuleReplacer replacer = new DisambiguationPatternRuleReplacer(this); return replacer.replace(sentence); }
[ "public", "final", "AnalyzedSentence", "replace", "(", "AnalyzedSentence", "sentence", ")", "throws", "IOException", "{", "DisambiguationPatternRuleReplacer", "replacer", "=", "new", "DisambiguationPatternRuleReplacer", "(", "this", ")", ";", "return", "replacer", ".", ...
Performs disambiguation on the source sentence. @param sentence {@link AnalyzedSentence} Sentence to be disambiguated. @return {@link AnalyzedSentence} Disambiguated sentence (might be unchanged).
[ "Performs", "disambiguation", "on", "the", "source", "sentence", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationPatternRule.java#L99-L102
19,166
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/MultipleWhitespaceRule.java
MultipleWhitespaceRule.isRemovableWhite
private static boolean isRemovableWhite(AnalyzedTokenReadings token) { return (token.isWhitespace() || StringTools.isNonBreakingWhitespace(token.getToken())) && !token.isLinebreak() && !token.getToken().equals("\t") && !token.getToken().equals("\u200B"); }
java
private static boolean isRemovableWhite(AnalyzedTokenReadings token) { return (token.isWhitespace() || StringTools.isNonBreakingWhitespace(token.getToken())) && !token.isLinebreak() && !token.getToken().equals("\t") && !token.getToken().equals("\u200B"); }
[ "private", "static", "boolean", "isRemovableWhite", "(", "AnalyzedTokenReadings", "token", ")", "{", "return", "(", "token", ".", "isWhitespace", "(", ")", "||", "StringTools", ".", "isNonBreakingWhitespace", "(", "token", ".", "getToken", "(", ")", ")", ")", ...
Removable white space are not linebreaks, tabs, functions or footnotes
[ "Removable", "white", "space", "are", "not", "linebreaks", "tabs", "functions", "or", "footnotes" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/MultipleWhitespaceRule.java#L62-L65
19,167
languagetool-org/languagetool
languagetool-language-modules/pl/src/main/java/org/languagetool/rules/pl/DecadeSpellingFilter.java
DecadeSpellingFilter.getRomanNumber
private String getRomanNumber(int num) { String roman = ""; // The roman numeral. int N = num; // N represents the part of num that still has // to be converted to Roman numeral representation. for (int i = 0; i < numbers.length; i++) { while (N >= numbers[i]) { roman += letters[...
java
private String getRomanNumber(int num) { String roman = ""; // The roman numeral. int N = num; // N represents the part of num that still has // to be converted to Roman numeral representation. for (int i = 0; i < numbers.length; i++) { while (N >= numbers[i]) { roman += letters[...
[ "private", "String", "getRomanNumber", "(", "int", "num", ")", "{", "String", "roman", "=", "\"\"", ";", "// The roman numeral.", "int", "N", "=", "num", ";", "// N represents the part of num that still has", "// to be converted to Roman numeral representation.", "for", ...
Gets the Roman notation for numbers. @param num the integer to convert @return the String using the number.
[ "Gets", "the", "Roman", "notation", "for", "numbers", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/pl/src/main/java/org/languagetool/rules/pl/DecadeSpellingFilter.java#L46-L57
19,168
languagetool-org/languagetool
languagetool-standalone/src/main/java/org/languagetool/gui/FontChooser.java
FontChooser.setSelectedFont
void setSelectedFont(Font font) { this.selectedFont = font; fontNameList.setSelectedValue(font.getFamily(), true); fontStyleList.setSelectedValue(getStyle(font), true); fontSizeList.setSelectedValue(font.getSize(), true); }
java
void setSelectedFont(Font font) { this.selectedFont = font; fontNameList.setSelectedValue(font.getFamily(), true); fontStyleList.setSelectedValue(getStyle(font), true); fontSizeList.setSelectedValue(font.getSize(), true); }
[ "void", "setSelectedFont", "(", "Font", "font", ")", "{", "this", ".", "selectedFont", "=", "font", ";", "fontNameList", ".", "setSelectedValue", "(", "font", ".", "getFamily", "(", ")", ",", "true", ")", ";", "fontStyleList", ".", "setSelectedValue", "(", ...
Sets the current font of the font chooser to the specified font. @param font the font to be set in the font chooser
[ "Sets", "the", "current", "font", "of", "the", "font", "chooser", "to", "the", "specified", "font", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-standalone/src/main/java/org/languagetool/gui/FontChooser.java#L113-L118
19,169
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/AbstractStyleRepeatedWordRule.java
AbstractStyleRepeatedWordRule.getSynonyms
public List<String> getSynonyms(AnalyzedTokenReadings token) { List<String> synonyms = new ArrayList<String>(); if(linguServices == null || token == null) { return synonyms; } List<AnalyzedToken> readings = token.getReadings(); for (AnalyzedToken reading : readings) { String lemma = read...
java
public List<String> getSynonyms(AnalyzedTokenReadings token) { List<String> synonyms = new ArrayList<String>(); if(linguServices == null || token == null) { return synonyms; } List<AnalyzedToken> readings = token.getReadings(); for (AnalyzedToken reading : readings) { String lemma = read...
[ "public", "List", "<", "String", ">", "getSynonyms", "(", "AnalyzedTokenReadings", "token", ")", "{", "List", "<", "String", ">", "synonyms", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "linguServices", "==", "null", "||", "tok...
get synonyms for a repeated word
[ "get", "synonyms", "for", "a", "repeated", "word" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/AbstractStyleRepeatedWordRule.java#L188-L216
19,170
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/synthesis/BaseSynthesizer.java
BaseSynthesizer.lookup
protected void lookup(String lemma, String posTag, List<String> results) { synchronized (this) { // the stemmer is not thread-safe List<WordData> wordForms = stemmer.lookup(lemma + "|" + posTag); for (WordData wd : wordForms) { results.add(wd.getStem().toString()); } } }
java
protected void lookup(String lemma, String posTag, List<String> results) { synchronized (this) { // the stemmer is not thread-safe List<WordData> wordForms = stemmer.lookup(lemma + "|" + posTag); for (WordData wd : wordForms) { results.add(wd.getStem().toString()); } } }
[ "protected", "void", "lookup", "(", "String", "lemma", ",", "String", "posTag", ",", "List", "<", "String", ">", "results", ")", "{", "synchronized", "(", "this", ")", "{", "// the stemmer is not thread-safe", "List", "<", "WordData", ">", "wordForms", "=", ...
Lookup the inflected forms of a lemma defined by a part-of-speech tag. @param lemma the lemma to be inflected. @param posTag the desired part-of-speech tag. @param results the list to collect the inflected forms.
[ "Lookup", "the", "inflected", "forms", "of", "a", "lemma", "defined", "by", "a", "part", "-", "of", "-", "speech", "tag", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/synthesis/BaseSynthesizer.java#L95-L102
19,171
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Configuration.java
Configuration.copy
Configuration copy(Configuration configuration) { Configuration copy = new Configuration(); copy.restoreState(configuration); return copy; }
java
Configuration copy(Configuration configuration) { Configuration copy = new Configuration(); copy.restoreState(configuration); return copy; }
[ "Configuration", "copy", "(", "Configuration", "configuration", ")", "{", "Configuration", "copy", "=", "new", "Configuration", "(", ")", ";", "copy", ".", "restoreState", "(", "configuration", ")", ";", "return", "copy", ";", "}" ]
Returns a copy of the given configuration. @param configuration the object to copy. @since 2.6
[ "Returns", "a", "copy", "of", "the", "given", "configuration", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Configuration.java#L169-L173
19,172
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Configuration.java
Configuration.restoreState
void restoreState(Configuration configuration) { this.configFile = configuration.configFile; this.language = configuration.language; this.motherTongue = configuration.motherTongue; this.ngramDirectory = configuration.ngramDirectory; this.word2vecDirectory = configuration.word2vecDirectory; this....
java
void restoreState(Configuration configuration) { this.configFile = configuration.configFile; this.language = configuration.language; this.motherTongue = configuration.motherTongue; this.ngramDirectory = configuration.ngramDirectory; this.word2vecDirectory = configuration.word2vecDirectory; this....
[ "void", "restoreState", "(", "Configuration", "configuration", ")", "{", "this", ".", "configFile", "=", "configuration", ".", "configFile", ";", "this", ".", "language", "=", "configuration", ".", "language", ";", "this", ".", "motherTongue", "=", "configuratio...
Restore the state of this object from configuration. @param configuration the object from which we will read the state @since 2.6
[ "Restore", "the", "state", "of", "this", "object", "from", "configuration", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Configuration.java#L180-L226
19,173
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.hasPosTag
public boolean hasPosTag(String posTag) { boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getPOSTag() != null) { found = posTag.equals(reading.getPOSTag()); if (found) { break; } } } return found; }
java
public boolean hasPosTag(String posTag) { boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getPOSTag() != null) { found = posTag.equals(reading.getPOSTag()); if (found) { break; } } } return found; }
[ "public", "boolean", "hasPosTag", "(", "String", "posTag", ")", "{", "boolean", "found", "=", "false", ";", "for", "(", "AnalyzedToken", "reading", ":", "anTokReadings", ")", "{", "if", "(", "reading", ".", "getPOSTag", "(", ")", "!=", "null", ")", "{", ...
Checks if the token has a particular POS tag. @param posTag POS tag to look for
[ "Checks", "if", "the", "token", "has", "a", "particular", "POS", "tag", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L116-L127
19,174
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.hasLemma
public boolean hasLemma(String lemma) { boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getLemma() != null) { found = lemma.equals(reading.getLemma()); if (found) { break; } } } return found; }
java
public boolean hasLemma(String lemma) { boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getLemma() != null) { found = lemma.equals(reading.getLemma()); if (found) { break; } } } return found; }
[ "public", "boolean", "hasLemma", "(", "String", "lemma", ")", "{", "boolean", "found", "=", "false", ";", "for", "(", "AnalyzedToken", "reading", ":", "anTokReadings", ")", "{", "if", "(", "reading", ".", "getLemma", "(", ")", "!=", "null", ")", "{", "...
Checks if one of the token's readings has a particular lemma. @param lemma lemma POS tag to look for
[ "Checks", "if", "one", "of", "the", "token", "s", "readings", "has", "a", "particular", "lemma", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L134-L145
19,175
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.hasAnyLemma
public boolean hasAnyLemma(String... lemmas) { boolean found = false; for(String lemma : lemmas) { for (AnalyzedToken reading : anTokReadings) { if (reading.getLemma() != null) { found = lemma.equals(reading.getLemma()); if (found) { return found; } ...
java
public boolean hasAnyLemma(String... lemmas) { boolean found = false; for(String lemma : lemmas) { for (AnalyzedToken reading : anTokReadings) { if (reading.getLemma() != null) { found = lemma.equals(reading.getLemma()); if (found) { return found; } ...
[ "public", "boolean", "hasAnyLemma", "(", "String", "...", "lemmas", ")", "{", "boolean", "found", "=", "false", ";", "for", "(", "String", "lemma", ":", "lemmas", ")", "{", "for", "(", "AnalyzedToken", "reading", ":", "anTokReadings", ")", "{", "if", "("...
Checks if one of the token's readings has one of the given lemmas @param lemmas to look for
[ "Checks", "if", "one", "of", "the", "token", "s", "readings", "has", "one", "of", "the", "given", "lemmas" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L152-L165
19,176
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.hasPartialPosTag
public boolean hasPartialPosTag(String posTag) { boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getPOSTag() != null) { found = reading.getPOSTag().contains(posTag); if (found) { break; } } } return found; }
java
public boolean hasPartialPosTag(String posTag) { boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getPOSTag() != null) { found = reading.getPOSTag().contains(posTag); if (found) { break; } } } return found; }
[ "public", "boolean", "hasPartialPosTag", "(", "String", "posTag", ")", "{", "boolean", "found", "=", "false", ";", "for", "(", "AnalyzedToken", "reading", ":", "anTokReadings", ")", "{", "if", "(", "reading", ".", "getPOSTag", "(", ")", "!=", "null", ")", ...
Checks if the token has a particular POS tag, where only a part of the given POS tag needs to match. @param posTag POS tag substring to look for @since 1.8
[ "Checks", "if", "the", "token", "has", "a", "particular", "POS", "tag", "where", "only", "a", "part", "of", "the", "given", "POS", "tag", "needs", "to", "match", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L173-L184
19,177
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.hasPosTagStartingWith
public boolean hasPosTagStartingWith(String posTag) { boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getPOSTag() != null) { found = reading.getPOSTag().startsWith(posTag); if (found) { break; } } } return found; }
java
public boolean hasPosTagStartingWith(String posTag) { boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getPOSTag() != null) { found = reading.getPOSTag().startsWith(posTag); if (found) { break; } } } return found; }
[ "public", "boolean", "hasPosTagStartingWith", "(", "String", "posTag", ")", "{", "boolean", "found", "=", "false", ";", "for", "(", "AnalyzedToken", "reading", ":", "anTokReadings", ")", "{", "if", "(", "reading", ".", "getPOSTag", "(", ")", "!=", "null", ...
Checks if the token has a POS tag starting with the given string. @param posTag POS tag substring to look for @since 4.0
[ "Checks", "if", "the", "token", "has", "a", "POS", "tag", "starting", "with", "the", "given", "string", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L207-L218
19,178
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.matchesPosTagRegex
public boolean matchesPosTagRegex(String posTagRegex) { Pattern pattern = Pattern.compile(posTagRegex); boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getPOSTag() != null) { found = pattern.matcher(reading.getPOSTag()).matches(); if (found) { ...
java
public boolean matchesPosTagRegex(String posTagRegex) { Pattern pattern = Pattern.compile(posTagRegex); boolean found = false; for (AnalyzedToken reading : anTokReadings) { if (reading.getPOSTag() != null) { found = pattern.matcher(reading.getPOSTag()).matches(); if (found) { ...
[ "public", "boolean", "matchesPosTagRegex", "(", "String", "posTagRegex", ")", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "posTagRegex", ")", ";", "boolean", "found", "=", "false", ";", "for", "(", "AnalyzedToken", "reading", ":", "anTokRea...
Checks if at least one of the readings matches a given POS tag regex. @param posTagRegex POS tag regular expression to look for @since 2.9
[ "Checks", "if", "at", "least", "one", "of", "the", "readings", "matches", "a", "given", "POS", "tag", "regex", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L226-L238
19,179
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.addReading
public void addReading(AnalyzedToken token) { List<AnalyzedToken> l = new ArrayList<>(Arrays.asList(anTokReadings).subList(0, anTokReadings.length - 1)); if (anTokReadings[anTokReadings.length - 1].getPOSTag() != null) { l.add(anTokReadings[anTokReadings.length - 1]); } token.setWhitespaceBefore(i...
java
public void addReading(AnalyzedToken token) { List<AnalyzedToken> l = new ArrayList<>(Arrays.asList(anTokReadings).subList(0, anTokReadings.length - 1)); if (anTokReadings[anTokReadings.length - 1].getPOSTag() != null) { l.add(anTokReadings[anTokReadings.length - 1]); } token.setWhitespaceBefore(i...
[ "public", "void", "addReading", "(", "AnalyzedToken", "token", ")", "{", "List", "<", "AnalyzedToken", ">", "l", "=", "new", "ArrayList", "<>", "(", "Arrays", ".", "asList", "(", "anTokReadings", ")", ".", "subList", "(", "0", ",", "anTokReadings", ".", ...
Add a new reading. @param token new reading, given as {@link AnalyzedToken}
[ "Add", "a", "new", "reading", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L244-L260
19,180
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.leaveReading
public void leaveReading(AnalyzedToken token) { List<AnalyzedToken> l = new ArrayList<>(); AnalyzedToken tmpTok = new AnalyzedToken(token.getToken(), token.getPOSTag(), token.getLemma()); tmpTok.setWhitespaceBefore(isWhitespaceBefore); for (AnalyzedToken anTokReading : anTokReadings) { if (anTokRe...
java
public void leaveReading(AnalyzedToken token) { List<AnalyzedToken> l = new ArrayList<>(); AnalyzedToken tmpTok = new AnalyzedToken(token.getToken(), token.getPOSTag(), token.getLemma()); tmpTok.setWhitespaceBefore(isWhitespaceBefore); for (AnalyzedToken anTokReading : anTokReadings) { if (anTokRe...
[ "public", "void", "leaveReading", "(", "AnalyzedToken", "token", ")", "{", "List", "<", "AnalyzedToken", ">", "l", "=", "new", "ArrayList", "<>", "(", ")", ";", "AnalyzedToken", "tmpTok", "=", "new", "AnalyzedToken", "(", "token", ".", "getToken", "(", ")"...
Removes all readings but the one that matches the token given. @param token Token to be matched @since 1.5
[ "Removes", "all", "readings", "but", "the", "one", "that", "matches", "the", "token", "given", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L305-L321
19,181
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.setParagraphEnd
public void setParagraphEnd() { if (!isParagraphEnd()) { AnalyzedToken paragraphEnd = new AnalyzedToken(getToken(), PARAGRAPH_END_TAGNAME, getAnalyzedToken(0).getLemma()); addReading(paragraphEnd); } }
java
public void setParagraphEnd() { if (!isParagraphEnd()) { AnalyzedToken paragraphEnd = new AnalyzedToken(getToken(), PARAGRAPH_END_TAGNAME, getAnalyzedToken(0).getLemma()); addReading(paragraphEnd); } }
[ "public", "void", "setParagraphEnd", "(", ")", "{", "if", "(", "!", "isParagraphEnd", "(", ")", ")", "{", "AnalyzedToken", "paragraphEnd", "=", "new", "AnalyzedToken", "(", "getToken", "(", ")", ",", "PARAGRAPH_END_TAGNAME", ",", "getAnalyzedToken", "(", "0", ...
Add a reading with a paragraph end token unless this is already a paragraph end. @since 2.3
[ "Add", "a", "reading", "with", "a", "paragraph", "end", "token", "unless", "this", "is", "already", "a", "paragraph", "end", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L360-L366
19,182
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.setSentEnd
public void setSentEnd() { if (!isSentenceEnd()) { AnalyzedToken sentenceEnd = new AnalyzedToken(getToken(), SENTENCE_END_TAGNAME, getAnalyzedToken(0).getLemma()); addReading(sentenceEnd); } }
java
public void setSentEnd() { if (!isSentenceEnd()) { AnalyzedToken sentenceEnd = new AnalyzedToken(getToken(), SENTENCE_END_TAGNAME, getAnalyzedToken(0).getLemma()); addReading(sentenceEnd); } }
[ "public", "void", "setSentEnd", "(", ")", "{", "if", "(", "!", "isSentenceEnd", "(", ")", ")", "{", "AnalyzedToken", "sentenceEnd", "=", "new", "AnalyzedToken", "(", "getToken", "(", ")", ",", "SENTENCE_END_TAGNAME", ",", "getAnalyzedToken", "(", "0", ")", ...
Add a SENT_END tag.
[ "Add", "a", "SENT_END", "tag", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L387-L393
19,183
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java
AnalyzedTokenReadings.areLemmasSame
private boolean areLemmasSame() { String previousLemma = anTokReadings[0].getLemma(); if (previousLemma == null) { for (AnalyzedToken element : anTokReadings) { if (element.getLemma() != null) { return false; } } return true; } for (AnalyzedToken element : anT...
java
private boolean areLemmasSame() { String previousLemma = anTokReadings[0].getLemma(); if (previousLemma == null) { for (AnalyzedToken element : anTokReadings) { if (element.getLemma() != null) { return false; } } return true; } for (AnalyzedToken element : anT...
[ "private", "boolean", "areLemmasSame", "(", ")", "{", "String", "previousLemma", "=", "anTokReadings", "[", "0", "]", ".", "getLemma", "(", ")", ";", "if", "(", "previousLemma", "==", "null", ")", "{", "for", "(", "AnalyzedToken", "element", ":", "anTokRea...
Used to configure the internal variable for lemma equality. @return true if all {@link AnalyzedToken} lemmas are the same. @since 2.5
[ "Used", "to", "configure", "the", "internal", "variable", "for", "lemma", "equality", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/AnalyzedTokenReadings.java#L550-L566
19,184
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/AbstractUnitConversionRule.java
AbstractUnitConversionRule.addUnit
protected void addUnit(String pattern, Unit base, String symbol, double factor, boolean metric) { Unit unit = base.multiply(factor); unitPatterns.put(Pattern.compile("\\b" + NUMBER_REGEX + "\\s{0," + WHITESPACE_LIMIT + "}" + pattern + "\\b"), unit); unitSymbols.putIfAbsent(unit, new ArrayList<>()); unit...
java
protected void addUnit(String pattern, Unit base, String symbol, double factor, boolean metric) { Unit unit = base.multiply(factor); unitPatterns.put(Pattern.compile("\\b" + NUMBER_REGEX + "\\s{0," + WHITESPACE_LIMIT + "}" + pattern + "\\b"), unit); unitSymbols.putIfAbsent(unit, new ArrayList<>()); unit...
[ "protected", "void", "addUnit", "(", "String", "pattern", ",", "Unit", "base", ",", "String", "symbol", ",", "double", "factor", ",", "boolean", "metric", ")", "{", "Unit", "unit", "=", "base", ".", "multiply", "(", "factor", ")", ";", "unitPatterns", "....
Associate a notation with a given unit. @param pattern Regex for recognizing the unit. Word boundaries and numbers are added to this pattern by addUnit itself. @param base Unit to associate with the pattern @param symbol Suffix used for suggestion. @param factor Convenience parameter for prefixes for metric units, unit...
[ "Associate", "a", "notation", "with", "a", "given", "unit", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/AbstractUnitConversionRule.java#L183-L191
19,185
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/AbstractUnitConversionRule.java
AbstractUnitConversionRule.getFormattedConversions
@NotNull private List<String> getFormattedConversions(List<Map.Entry<Unit, Double>> conversions) { List<String> formatted = new ArrayList<>(); for (Map.Entry<Unit, Double> equivalent : conversions) { Unit metric = equivalent.getKey(); double converted = equivalent.getValue(); long rounded = ...
java
@NotNull private List<String> getFormattedConversions(List<Map.Entry<Unit, Double>> conversions) { List<String> formatted = new ArrayList<>(); for (Map.Entry<Unit, Double> equivalent : conversions) { Unit metric = equivalent.getKey(); double converted = equivalent.getValue(); long rounded = ...
[ "@", "NotNull", "private", "List", "<", "String", ">", "getFormattedConversions", "(", "List", "<", "Map", ".", "Entry", "<", "Unit", ",", "Double", ">", ">", "conversions", ")", "{", "List", "<", "String", ">", "formatted", "=", "new", "ArrayList", "<>"...
Adds different formatted variants of the given conversions up to MAX_SUGGESTIONS. @param conversions as computed by getMetricEquivalent @return formatted numbers, with various units and unit symbols, rounded to integers or according to getNumberFormat
[ "Adds", "different", "formatted", "variants", "of", "the", "given", "conversions", "up", "to", "MAX_SUGGESTIONS", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/AbstractUnitConversionRule.java#L330-L356
19,186
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/OfficeTools.java
OfficeTools.getCurrentDesktop
@Nullable public static XDesktop getCurrentDesktop(XComponentContext xContext) { try { if (xContext == null) { return null; } XMultiComponentFactory xMCF = UnoRuntime.queryInterface(XMultiComponentFactory.class, xContext.getServiceManager()); if (xMCF == null) { ...
java
@Nullable public static XDesktop getCurrentDesktop(XComponentContext xContext) { try { if (xContext == null) { return null; } XMultiComponentFactory xMCF = UnoRuntime.queryInterface(XMultiComponentFactory.class, xContext.getServiceManager()); if (xMCF == null) { ...
[ "@", "Nullable", "public", "static", "XDesktop", "getCurrentDesktop", "(", "XComponentContext", "xContext", ")", "{", "try", "{", "if", "(", "xContext", "==", "null", ")", "{", "return", "null", ";", "}", "XMultiComponentFactory", "xMCF", "=", "UnoRuntime", "....
Returns the current XDesktop Returns null if it fails
[ "Returns", "the", "current", "XDesktop", "Returns", "null", "if", "it", "fails" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/OfficeTools.java#L47-L67
19,187
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/OfficeTools.java
OfficeTools.getCurrentComponent
@Nullable public static XComponent getCurrentComponent(XComponentContext xContext) { try { XDesktop xdesktop = getCurrentDesktop(xContext); if(xdesktop == null) { return null; } else return xdesktop.getCurrentComponent(); } catch (Throwable t) { MessageHandler.printExcept...
java
@Nullable public static XComponent getCurrentComponent(XComponentContext xContext) { try { XDesktop xdesktop = getCurrentDesktop(xContext); if(xdesktop == null) { return null; } else return xdesktop.getCurrentComponent(); } catch (Throwable t) { MessageHandler.printExcept...
[ "@", "Nullable", "public", "static", "XComponent", "getCurrentComponent", "(", "XComponentContext", "xContext", ")", "{", "try", "{", "XDesktop", "xdesktop", "=", "getCurrentDesktop", "(", "xContext", ")", ";", "if", "(", "xdesktop", "==", "null", ")", "{", "r...
Returns the current XComponent Returns null if it fails
[ "Returns", "the", "current", "XComponent", "Returns", "null", "if", "it", "fails" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/OfficeTools.java#L73-L85
19,188
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/suggestions/SuggestionsOrdererFeatureExtractor.java
SuggestionsOrdererFeatureExtractor.computeFeatures
public Pair<List<SuggestedReplacement>, SortedMap<String, Float>> computeFeatures(List<String> suggestions, String word, AnalyzedSentence sentence, int startPos) { if (suggestions.isEmpty()) { return Pair.of(Collections.emptyList(), Collections.emptySortedMap()); } if (topN <= 0) { topN = sugges...
java
public Pair<List<SuggestedReplacement>, SortedMap<String, Float>> computeFeatures(List<String> suggestions, String word, AnalyzedSentence sentence, int startPos) { if (suggestions.isEmpty()) { return Pair.of(Collections.emptyList(), Collections.emptySortedMap()); } if (topN <= 0) { topN = sugges...
[ "public", "Pair", "<", "List", "<", "SuggestedReplacement", ">", ",", "SortedMap", "<", "String", ",", "Float", ">", ">", "computeFeatures", "(", "List", "<", "String", ">", "suggestions", ",", "String", "word", ",", "AnalyzedSentence", "sentence", ",", "int...
compute features for training or prediction of a ranking model for suggestions @param suggestions @param word @param sentence @param startPos @return correction candidates, features for the match in general, features specific to candidates
[ "compute", "features", "for", "training", "or", "prediction", "of", "a", "ranking", "model", "for", "suggestions" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/suggestions/SuggestionsOrdererFeatureExtractor.java#L92-L133
19,189
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/RuleInformation.java
RuleInformation.ignoreForIncompleteSentences
public static boolean ignoreForIncompleteSentences(String ruleId, Language lang) { return rules.contains(new Key(lang.getShortCode(), ruleId)); }
java
public static boolean ignoreForIncompleteSentences(String ruleId, Language lang) { return rules.contains(new Key(lang.getShortCode(), ruleId)); }
[ "public", "static", "boolean", "ignoreForIncompleteSentences", "(", "String", "ruleId", ",", "Language", "lang", ")", "{", "return", "rules", ".", "contains", "(", "new", "Key", "(", "lang", ".", "getShortCode", "(", ")", ",", "ruleId", ")", ")", ";", "}" ...
Whether this rule should be ignored when the sentence isn't finished yet. @since 4.4
[ "Whether", "this", "rule", "should", "be", "ignored", "when", "the", "sentence", "isn", "t", "finished", "yet", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/RuleInformation.java#L65-L67
19,190
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tools/Tools.java
Tools.i18n
public static String i18n(ResourceBundle messages, String key, Object... messageArguments) { MessageFormat formatter = new MessageFormat(""); formatter.applyPattern(messages.getString(key).replaceAll("'", "''")); return formatter.format(messageArguments); }
java
public static String i18n(ResourceBundle messages, String key, Object... messageArguments) { MessageFormat formatter = new MessageFormat(""); formatter.applyPattern(messages.getString(key).replaceAll("'", "''")); return formatter.format(messageArguments); }
[ "public", "static", "String", "i18n", "(", "ResourceBundle", "messages", ",", "String", "key", ",", "Object", "...", "messageArguments", ")", "{", "MessageFormat", "formatter", "=", "new", "MessageFormat", "(", "\"\"", ")", ";", "formatter", ".", "applyPattern",...
Translate a text string based on our i18n files. @since 3.1
[ "Translate", "a", "text", "string", "based", "on", "our", "i18n", "files", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/Tools.java#L55-L59
19,191
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tools/Tools.java
Tools.getAllBuiltinBitextRules
private static List<BitextRule> getAllBuiltinBitextRules(Language language, ResourceBundle messages) { List<BitextRule> rules = new ArrayList<>(); try { List<Class<? extends BitextRule>> classes = BitextRule.getRelevantRules(); for (Class class1 : classes) { Constructor[] constructors ...
java
private static List<BitextRule> getAllBuiltinBitextRules(Language language, ResourceBundle messages) { List<BitextRule> rules = new ArrayList<>(); try { List<Class<? extends BitextRule>> classes = BitextRule.getRelevantRules(); for (Class class1 : classes) { Constructor[] constructors ...
[ "private", "static", "List", "<", "BitextRule", ">", "getAllBuiltinBitextRules", "(", "Language", "language", ",", "ResourceBundle", "messages", ")", "{", "List", "<", "BitextRule", ">", "rules", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "{", "Lis...
Use reflection to add bitext rules.
[ "Use", "reflection", "to", "add", "bitext", "rules", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/Tools.java#L152-L190
19,192
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tools/Tools.java
Tools.selectRules
public static void selectRules(JLanguageTool lt, List<String> disabledRuleIds, List<String> enabledRuleIds, boolean useEnabledOnly) { Set<String> disabledRuleIdsSet = new HashSet<>(); disabledRuleIdsSet.addAll(disabledRuleIds); Set<String> enabledRuleIdsSet = new HashSet<>(); enabledRuleIdsSet.addAll(en...
java
public static void selectRules(JLanguageTool lt, List<String> disabledRuleIds, List<String> enabledRuleIds, boolean useEnabledOnly) { Set<String> disabledRuleIdsSet = new HashSet<>(); disabledRuleIdsSet.addAll(disabledRuleIds); Set<String> enabledRuleIdsSet = new HashSet<>(); enabledRuleIdsSet.addAll(en...
[ "public", "static", "void", "selectRules", "(", "JLanguageTool", "lt", ",", "List", "<", "String", ">", "disabledRuleIds", ",", "List", "<", "String", ">", "enabledRuleIds", ",", "boolean", "useEnabledOnly", ")", "{", "Set", "<", "String", ">", "disabledRuleId...
Enable and disable rules of the given LanguageTool instance. @param lt LanguageTool object @param disabledRuleIds ids of the rules to be disabled @param enabledRuleIds ids of the rules to be enabled @param useEnabledOnly if set to {@code true}, disable all rules except those enabled explicitly
[ "Enable", "and", "disable", "rules", "of", "the", "given", "LanguageTool", "instance", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/Tools.java#L286-L292
19,193
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tools/Tools.java
Tools.selectBitextRules
public static List<BitextRule> selectBitextRules(List<BitextRule> bRules, List<String> disabledRules, List<String> enabledRules, boolean useEnabledOnly) { List<BitextRule> newBRules = new ArrayList<>(bRules.size()); newBRules.addAll(bRules); List<BitextRule> rulesToDisable = new ArrayList<>(); if (useEn...
java
public static List<BitextRule> selectBitextRules(List<BitextRule> bRules, List<String> disabledRules, List<String> enabledRules, boolean useEnabledOnly) { List<BitextRule> newBRules = new ArrayList<>(bRules.size()); newBRules.addAll(bRules); List<BitextRule> rulesToDisable = new ArrayList<>(); if (useEn...
[ "public", "static", "List", "<", "BitextRule", ">", "selectBitextRules", "(", "List", "<", "BitextRule", ">", "bRules", ",", "List", "<", "String", ">", "disabledRules", ",", "List", "<", "String", ">", "enabledRules", ",", "boolean", "useEnabledOnly", ")", ...
Enable and disable bitext rules. @param bRules List of all bitext rules @param disabledRules ids of rules to be disabled @param enabledRules ids of rules to be enabled (by default all are enabled) @param useEnabledOnly if set to {@code true}, if set to {@code true}, disable all rules except those enabled explicitly. @r...
[ "Enable", "and", "disable", "bitext", "rules", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/Tools.java#L345-L368
19,194
languagetool-org/languagetool
languagetool-language-modules/uk/src/main/java/org/languagetool/tagging/uk/CompoundTagger.java
CompoundTagger.getNumAgreedPosTag
@Nullable private String getNumAgreedPosTag(String leftPosTag, String rightPosTag, boolean leftNv) { String agreedPosTag = null; if( leftPosTag.contains(":p:") && SING_REGEX_F.matcher(rightPosTag).find() || SING_REGEX_F.matcher(leftPosTag).find() && rightPosTag.contains(":p:")) { String lef...
java
@Nullable private String getNumAgreedPosTag(String leftPosTag, String rightPosTag, boolean leftNv) { String agreedPosTag = null; if( leftPosTag.contains(":p:") && SING_REGEX_F.matcher(rightPosTag).find() || SING_REGEX_F.matcher(leftPosTag).find() && rightPosTag.contains(":p:")) { String lef...
[ "@", "Nullable", "private", "String", "getNumAgreedPosTag", "(", "String", "leftPosTag", ",", "String", "rightPosTag", ",", "boolean", "leftNv", ")", "{", "String", "agreedPosTag", "=", "null", ";", "if", "(", "leftPosTag", ".", "contains", "(", "\":p:\"", ")"...
right part is numr
[ "right", "part", "is", "numr" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/uk/src/main/java/org/languagetool/tagging/uk/CompoundTagger.java#L924-L936
19,195
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternTokenBuilder.java
PatternTokenBuilder.csToken
public PatternTokenBuilder csToken(String token) { this.token = Objects.requireNonNull(token); caseSensitive = true; return this; }
java
public PatternTokenBuilder csToken(String token) { this.token = Objects.requireNonNull(token); caseSensitive = true; return this; }
[ "public", "PatternTokenBuilder", "csToken", "(", "String", "token", ")", "{", "this", ".", "token", "=", "Objects", ".", "requireNonNull", "(", "token", ")", ";", "caseSensitive", "=", "true", ";", "return", "this", ";", "}" ]
Add a case-sensitive token. @since 3.3
[ "Add", "a", "case", "-", "sensitive", "token", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternTokenBuilder.java#L52-L56
19,196
languagetool-org/languagetool
languagetool-server/src/main/java/org/languagetool/server/UserLimits.java
UserLimits.getLimitsFromToken
static UserLimits getLimitsFromToken(HTTPServerConfig config, String jwtToken) { Objects.requireNonNull(jwtToken); try { String secretKey = config.getSecretTokenKey(); if (secretKey == null) { throw new RuntimeException("You specified a 'token' parameter but this server doesn't accept tokens...
java
static UserLimits getLimitsFromToken(HTTPServerConfig config, String jwtToken) { Objects.requireNonNull(jwtToken); try { String secretKey = config.getSecretTokenKey(); if (secretKey == null) { throw new RuntimeException("You specified a 'token' parameter but this server doesn't accept tokens...
[ "static", "UserLimits", "getLimitsFromToken", "(", "HTTPServerConfig", "config", ",", "String", "jwtToken", ")", "{", "Objects", ".", "requireNonNull", "(", "jwtToken", ")", ";", "try", "{", "String", "secretKey", "=", "config", ".", "getSecretTokenKey", "(", ")...
Get limits from the JWT key itself, no database access needed.
[ "Get", "limits", "from", "the", "JWT", "key", "itself", "no", "database", "access", "needed", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/UserLimits.java#L65-L92
19,197
languagetool-org/languagetool
languagetool-server/src/main/java/org/languagetool/server/UserLimits.java
UserLimits.getLimitsByApiKey
public static UserLimits getLimitsByApiKey(HTTPServerConfig config, String username, String apiKey) { DatabaseAccess db = DatabaseAccess.getInstance(); Long id = db.getUserId(username, apiKey); return new UserLimits(config.maxTextLengthWithApiKey, config.maxCheckTimeWithApiKeyMillis, id); }
java
public static UserLimits getLimitsByApiKey(HTTPServerConfig config, String username, String apiKey) { DatabaseAccess db = DatabaseAccess.getInstance(); Long id = db.getUserId(username, apiKey); return new UserLimits(config.maxTextLengthWithApiKey, config.maxCheckTimeWithApiKeyMillis, id); }
[ "public", "static", "UserLimits", "getLimitsByApiKey", "(", "HTTPServerConfig", "config", ",", "String", "username", ",", "String", "apiKey", ")", "{", "DatabaseAccess", "db", "=", "DatabaseAccess", ".", "getInstance", "(", ")", ";", "Long", "id", "=", "db", "...
Get limits from the api key itself, database access is needed.
[ "Get", "limits", "from", "the", "api", "key", "itself", "database", "access", "is", "needed", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/UserLimits.java#L97-L101
19,198
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/MultiDocumentsHandler.java
MultiDocumentsHandler.getLanguage
@Nullable public Language getLanguage() { XComponent xComponent = OfficeTools.getCurrentComponent(xContext); Locale charLocale; XPropertySet xCursorProps; try { XModel model = UnoRuntime.queryInterface(XModel.class, xComponent); if(model == null) { return Languages.getLanguageForSh...
java
@Nullable public Language getLanguage() { XComponent xComponent = OfficeTools.getCurrentComponent(xContext); Locale charLocale; XPropertySet xCursorProps; try { XModel model = UnoRuntime.queryInterface(XModel.class, xComponent); if(model == null) { return Languages.getLanguageForSh...
[ "@", "Nullable", "public", "Language", "getLanguage", "(", ")", "{", "XComponent", "xComponent", "=", "OfficeTools", ".", "getCurrentComponent", "(", "xContext", ")", ";", "Locale", "charLocale", ";", "XPropertySet", "xCursorProps", ";", "try", "{", "XModel", "m...
Checks the language under the cursor. Used for opening the configuration dialog. @return the language under the visible cursor
[ "Checks", "the", "language", "under", "the", "cursor", ".", "Used", "for", "opening", "the", "configuration", "dialog", "." ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/MultiDocumentsHandler.java#L218-L279
19,199
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/MultiDocumentsHandler.java
MultiDocumentsHandler.setConfigValues
private void setConfigValues(Configuration config, JLanguageTool langTool) { this.config = config; this.langTool = langTool; this.noMultiReset = config.isNoMultiReset(); for (SingleDocument document : documents) { document.setConfigValues(config); } }
java
private void setConfigValues(Configuration config, JLanguageTool langTool) { this.config = config; this.langTool = langTool; this.noMultiReset = config.isNoMultiReset(); for (SingleDocument document : documents) { document.setConfigValues(config); } }
[ "private", "void", "setConfigValues", "(", "Configuration", "config", ",", "JLanguageTool", "langTool", ")", "{", "this", ".", "config", "=", "config", ";", "this", ".", "langTool", "=", "langTool", ";", "this", ".", "noMultiReset", "=", "config", ".", "isNo...
Set config Values for all documents
[ "Set", "config", "Values", "for", "all", "documents" ]
b7a3d63883d242fb2525877c6382681c57a0a142
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/MultiDocumentsHandler.java#L305-L312