Revision: 7225
http://languagetool.svn.sourceforge.net/languagetool/?rev=7225&view=rev
Author: dnaber
Date: 2012-06-03 20:43:20 +0000 (Sun, 03 Jun 2012)
Log Message:
-----------
corpus checker: check example sentences in XML, link export mode from default
mode
Modified Paths:
--------------
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
trunk/ltcommunity/grails-app/views/ruleEditor/expert.gsp
trunk/ltcommunity/grails-app/views/ruleEditor/index.gsp
Modified:
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
===================================================================
---
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
2012-06-03 20:37:17 UTC (rev 7224)
+++
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
2012-06-03 20:43:20 UTC (rev 7225)
@@ -90,6 +90,10 @@
List problems = []
List shortProblems = []
checkExampleSentences(patternRule, language, problems, shortProblems)
+ if (problems.size() > 0) {
+ render(template: 'checkRuleProblem', model: [problems: problems,
hasRegex: hasRegex(patternRule)])
+ return
+ }
SearcherResult searcherResult = checkRuleAgainstCorpus(patternRule,
language)
render(view: '_corpusResult', model: [searcherResult: searcherResult,
expertMode: true, limit: CORPUS_MATCH_LIMIT])
}
@@ -123,16 +127,18 @@
throw new Exception("No incorrect example sentences found")
}
for (incorrectExample in incorrectExamples) {
- List expectedRuleMatches =
langTool.check(incorrectExample.getExample())
+ String sentence =
incorrectExample.getExample().replace("<marker>", "").replace("</marker>", "")
+ List expectedRuleMatches = langTool.check(sentence)
if (expectedRuleMatches.size() == 0) {
- problems.add("The rule did not find the expected error in
'${incorrectExample}'")
+ problems.add("The rule did not find the expected error in
'${sentence}'")
shortProblems.add("errorNotFound")
}
}
for (correctExample in correctExamples) {
- List unexpectedRuleMatches = langTool.check(correctExample)
+ String sentence = correctExample.replace("<marker>",
"").replace("</marker>", "")
+ List unexpectedRuleMatches = langTool.check(sentence)
if (unexpectedRuleMatches.size() > 0) {
- problems.add("The rule found an unexptected error in
'${correctExample}'")
+ problems.add("The rule found an unexpected error in
'${sentence}'")
shortProblems.add("unexpectedErrorFound")
}
}
Modified: trunk/ltcommunity/grails-app/views/ruleEditor/expert.gsp
===================================================================
--- trunk/ltcommunity/grails-app/views/ruleEditor/expert.gsp 2012-06-03
20:37:17 UTC (rev 7224)
+++ trunk/ltcommunity/grails-app/views/ruleEditor/expert.gsp 2012-06-03
20:43:20 UTC (rev 7225)
@@ -26,8 +26,11 @@
<g:form name="ruleForm" method="post" action="checkRule">
- <p>Enter a single LanguageTool XML rule here to check it
against Wikipedia data:</p>
+ <p style="width:550px;text-align: right"><g:link
action="index">Simple Mode</g:link></p>
+ <p>Enter a single LanguageTool XML rule (everything and
including from <tt><rule></tt> to <tt></rule></tt>)
+ here to check it against Wikipedia data:</p>
+
<g:select style="margin-bottom: 5px" name="language"
from="${languageNames}" value="English"/><br/>
<g:textArea name="xml" rows="15" cols="100"></g:textArea>
Modified: trunk/ltcommunity/grails-app/views/ruleEditor/index.gsp
===================================================================
--- trunk/ltcommunity/grails-app/views/ruleEditor/index.gsp 2012-06-03
20:37:17 UTC (rev 7224)
+++ trunk/ltcommunity/grails-app/views/ruleEditor/index.gsp 2012-06-03
20:43:20 UTC (rev 7225)
@@ -45,6 +45,8 @@
<table style="border: 0px">
<tr>
<td colspan="2">
+ <p style="width:550px;text-align: right"><g:link
action="expert">Expert Mode</g:link></p>
+
<p style="width:550px">LanguageTool finds errors
based on rules. Most of these rules are expressed
as XML, and this page will help you to create your
own simple rules in XML.</p>
</td>
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs