Revision: 8271
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=8271&view=rev
Author:   dnaber
Date:     2012-10-31 20:35:47 +0000 (Wed, 31 Oct 2012)
Log Message:
-----------
use the same disabled rules for the online Wikipedia check ("WikiCheck") as for 
the offline check

Modified Paths:
--------------
    
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ltcommunity/disabled_rules.properties
    trunk/ltcommunity/grails-app/conf/Config.groovy
    
trunk/ltcommunity/grails-app/controllers/org/languagetool/WikiCheckController.groovy

Modified: 
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ltcommunity/disabled_rules.properties
===================================================================
--- 
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ltcommunity/disabled_rules.properties
      2012-10-31 20:31:12 UTC (rev 8270)
+++ 
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ltcommunity/disabled_rules.properties
      2012-10-31 20:35:47 UTC (rev 8271)
@@ -1,5 +1,5 @@
 # IDs of rules to be disabled for Wikipedia check at
-# http://community.languagetool.org/corpusMatch/list?lang=en
+# http://community.languagetool.org/corpusMatch and 
http://www.languagetool.org/wikicheck/
 
 
all=UNPAIRED_BRACKETS,UPPERCASE_SENTENCE_START,WORD_REPEAT_RULE,COMMA_PARENTHESIS_WHITESPACE,WHITESPACE_RULE,WORD_REPEAT_BEGINNING_RULE
 

Modified: trunk/ltcommunity/grails-app/conf/Config.groovy
===================================================================
--- trunk/ltcommunity/grails-app/conf/Config.groovy     2012-10-31 20:31:12 UTC 
(rev 8270)
+++ trunk/ltcommunity/grails-app/conf/Config.groovy     2012-10-31 20:35:47 UTC 
(rev 8271)
@@ -46,6 +46,8 @@
 // not properly supported yet):
 hide.languages = ["cs", "ml", "be", "da", "sk", "zh", "ast", "km", "en-GB", 
"en-US"]
 maxPatternElements = 5
+// disable some rules for WikiCheck to avoid too many false alarms:
+disabledRulesPropFile="/home/languagetool/ltcommunity/corpus/ltcommunity/disabled_rules.properties"
 
 // Lucene index directories for fast rule matching - "LANG" will be replaced 
with the language code:
 fastSearchIndex = "/home/languagetool/corpus/LANG"

Modified: 
trunk/ltcommunity/grails-app/controllers/org/languagetool/WikiCheckController.groovy
===================================================================
--- 
trunk/ltcommunity/grails-app/controllers/org/languagetool/WikiCheckController.groovy
        2012-10-31 20:31:12 UTC (rev 8270)
+++ 
trunk/ltcommunity/grails-app/controllers/org/languagetool/WikiCheckController.groovy
        2012-10-31 20:35:47 UTC (rev 8271)
@@ -27,24 +27,15 @@
 
 class WikiCheckController extends BaseController {
 
-    // disable some rules because of too many false alarms:
-    private static final List<String> DEFAULT_DISABLED_RULES =
-        Arrays.asList("WHITESPACE_RULE", "UNPAIRED_BRACKETS", 
"UPPERCASE_SENTENCE_START", "COMMA_PARENTHESIS_WHITESPACE")
-    private static final Map<String,List<String>> LANG_TO_DISABLED_RULES = new 
HashMap<String, List<String>>()
-
     private static final Pattern XML_TITLE_PATTERN = 
Pattern.compile("title=\"(.*?)\"")
 
-    static {
-        LANG_TO_DISABLED_RULES.put("en", Arrays.asList("EN_QUOTES", 
"ENGLISH_WORD_REPEAT_BEGINNING_RULE"))
-        LANG_TO_DISABLED_RULES.put("de", Arrays.asList("DE_CASE", 
"DE_AGREEMENT", "PFEILE", "BISSTRICH", "AUSLASSUNGSPUNKTE", "MALZEICHEN"))
-        LANG_TO_DISABLED_RULES.put("fr", Arrays.asList("FRENCH_WHITESPACE"))
-        LANG_TO_DISABLED_RULES.put("pl", Arrays.asList("BRAK_SPACJI"))
-    }
-
     private String CONVERT_URL_PREFIX = 
"http://community.languagetool.org/wikipediatotext/wikiSyntaxConverter/convert?url=";
 
     def index = {
         if (params.url) {
+            final Properties langToDisabledRules = new Properties()
+            langToDisabledRules.load(new 
FileInputStream(grailsApplication.config.disabledRulesPropFile))
+
             long startTime = System.currentTimeMillis()
             if (params.url.contains("languagetool.org/wikiCheck/")) {
                 throw new Exception("You clicked the WikiCheck bookmarklet - 
this link only works when you put it in your bookmarks and call the bookmark 
while you're on a Wikipedia page")
@@ -61,8 +52,8 @@
             if (params.disabled) {
                 
checker.setDisabledRuleIds(Arrays.asList(params.disabled.split(",")))
             } else {
-                List<String> allDisabledRules = new 
ArrayList<String>(DEFAULT_DISABLED_RULES)
-                List<String> langSpecificDisabledRules = 
LANG_TO_DISABLED_RULES.get(language.getShortName())
+                List<String> allDisabledRules = 
langToDisabledRules.getProperty("all").split(",")
+                List<String> langSpecificDisabledRules = 
langToDisabledRules.get(language.getShortName()).split(",")
                 if (langSpecificDisabledRules) {
                     allDisabledRules.addAll(langSpecificDisabledRules)
                 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Languagetool-commits mailing list
Languagetool-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-commits

Reply via email to