org.languagetool.JLanguageTool Java Examples
The following examples show how to use
org.languagetool.JLanguageTool.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Application.java From chatbot with Apache License 2.0 | 5 votes |
@Autowired public Helper(final CloudantClient cloudantClient, WolframRepository wolframRepository, @Value("${cloudant.chatDB}") String chatDBName, @Value("${cloudant.feedbackDB}") String feedbackDBName, @Value("${cloudant.explorerDB}") String explorerDBName, @Value("${tmdb.apiKey}") String tmdbApiKey) { try { chatDB = cloudantClient.database(chatDBName, true); feedbackDB = cloudantClient.database(feedbackDBName, true); explorerDB = cloudantClient.database(explorerDBName, true); } catch(Exception e) { logger.info("ERROR HERE"); e.printStackTrace(); } finally { this.tmdbApiKey = tmdbApiKey; this.wolframRepository = wolframRepository; riveScriptBot = new RiveScriptBot(); eliza = new ElizaMain(); eliza.readScript(true, "src/main/resources/eliza/script"); sparql = new SPARQL(explorerDB); languageTool = new JLanguageTool(new AmericanEnglish()); for (Rule rule : languageTool.getAllActiveRules()) { if (rule instanceof SpellingCheckRule) { List<String> wordsToIgnore = Arrays.asList(new String[] {"nlp", "merkel"}); ((SpellingCheckRule) rule).addIgnoreTokens(wordsToIgnore); } } } }
Example #2
Source File: SpellingCheck.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 5 votes |
private JLanguageTool createLanguageTool() { JLanguageTool jLanguageTool = new JLanguageTool(Languages.getLanguageForShortName(language)); Arrays.stream(rulesToIgnore.split(",")).forEach(jLanguageTool::disableRule); jLanguageTool.getAllActiveRules() .stream() .filter(r -> r instanceof SpellingCheckRule) .forEach(r -> ((SpellingCheckRule) r).addIgnoreTokens(Arrays.asList(wordsToIgnore.split(",")))); return jLanguageTool; }
Example #3
Source File: EditorTopComponent.java From Open-LaTeX-Studio with MIT License | 5 votes |
private void setupSpellCheckTool() { painter = new DefaultHighlighter.DefaultHighlightPainter(Color.PINK); //Default color is: PINK langTool = new JLanguageTool(new AmericanEnglish()); //Default Language is: American English for (Rule rule : langTool.getAllActiveRules()) { if (rule instanceof SpellingCheckRule) { ((SpellingCheckRule)rule).acceptPhrases(getLatexTerms()); //Accept LaText Terms from tex.cwl ((SpellingCheckRule)rule).acceptPhrases(Arrays.asList("documentclass", "maketitle", "tex", "TEX", "Tex")); //Accept some TEX terms not contained in tex.cwl } } }
Example #4
Source File: Application.java From chatbot with Apache License 2.0 | 4 votes |
public JLanguageTool getLanguageTool() { return languageTool; }
Example #5
Source File: Corrector.java From zest-writer with GNU General Public License v3.0 | 4 votes |
public Corrector() { langTool = new JLanguageTool(new French()); wordsToIgnore = new ArrayList<>(); langTool.disableRules(Arrays.asList("FRENCH_WHITESPACE", "WHITESPACE_RULE")); }
Example #6
Source File: EditorTopComponent.java From Open-LaTeX-Studio with MIT License | 4 votes |
public JLanguageTool getLangTool() { return langTool; }
Example #7
Source File: EditorTopComponent.java From Open-LaTeX-Studio with MIT License | 4 votes |
public void setLangTool(JLanguageTool langTool) { this.langTool = langTool; }