Revision: 7249 http://languagetool.svn.sourceforge.net/languagetool/?rev=7249&view=rev Author: milek_pl Date: 2012-06-05 20:15:26 +0000 (Tue, 05 Jun 2012) Log Message: ----------- add "LanguageTool" to the dictionary so that it is not highlighted
Modified Paths: -------------- trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/Hunspell.java trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellLibrary.java trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellRule.java Modified: trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/Hunspell.java =================================================================== --- trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/Hunspell.java 2012-06-05 20:14:36 UTC (rev 7248) +++ trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/Hunspell.java 2012-06-05 20:15:26 UTC (rev 7249) @@ -427,6 +427,15 @@ } return affixWordChars; } + + /** + * Adds a word to the runtime dictionary. + * @param word Word to be added. + * @throws UnsupportedEncodingException + */ + public void addWord(final String word) throws UnsupportedEncodingException { + hsl.Hunspell_add(hunspellDict, stringToBytes(word)); + } } } Modified: trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellLibrary.java =================================================================== --- trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellLibrary.java 2012-06-05 20:14:36 UTC (rev 7248) +++ trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellLibrary.java 2012-06-05 20:15:26 UTC (rev 7249) @@ -56,5 +56,12 @@ * @param word The word to offer suggestions for. */ public int Hunspell_suggest(Pointer pHunspell, PointerByReference slst, byte[] word); + + /** + * Add a word to the run-time dictionary. + * @param pHunspell The Hunspell object returned by Hunspell_create + * @param word The word added to the runtime dictionary. + */ + public int Hunspell_add(Pointer pHunspell, byte[] word); } Modified: trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellRule.java =================================================================== --- trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellRule.java 2012-06-05 20:14:36 UTC (rev 7248) +++ trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellRule.java 2012-06-05 20:15:26 UTC (rev 7249) @@ -137,6 +137,8 @@ if (!"".equals(dictionary.getWordChars())) { wordChars = "(?![" + dictionary.getWordChars().replace("-", "\\-") + "])"; } + + dictionary.addWord("LanguageTool"); // to make demo text check 4 times faster... } nonWordPattern = Pattern.compile(wordChars + NON_ALPHABETIC); needsInit = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Languagetool-cvs mailing list Languagetool-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-cvs