Skip to content

Commit

Permalink
[de] fixed some false alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
gulp21 committed Dec 23, 2013
1 parent 54eedc2 commit eacee98
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ private GrammarCategory(String displayName) {
PREPOSITIONS.add("bei");
PREPOSITIONS.add("nach");
PREPOSITIONS.add("über");
PREPOSITIONS.add("von");
PREPOSITIONS.add("mit");
// TODO: add more
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ else if (hasUnambiguouslyPersonAndNumber(tokens[i], "2", "SIN")) {
posVer2Sin = i;
} else if (hasUnambiguouslyPersonAndNumber(tokens[i], "1", "PLU")) {
posVer1Plu = i;
// } else if (hasUnambiguouslyPersonAndNumber(tokens[i], "2", "PLU")) {
// posVer2Plu = i;
// } else if (hasUnambiguouslyPersonAndNumber(tokens[i], "2", "PLU")) {
// posVer2Plu = i;
}

if (tokens[i].hasPartialPosTag(":1:SIN"))
Expand All @@ -140,8 +140,8 @@ else if (hasUnambiguouslyPersonAndNumber(tokens[i], "2", "SIN")) {
posPossibleVer3Sin = i;
if (tokens[i].hasPartialPosTag(":1:PLU"))
posPossibleVer1Plu = i;
// if (tokens[i].hasPartialPosTag(":2:PLU"))
// posPossibleVer2Plu = i;
// if (tokens[i].hasPartialPosTag(":2:PLU"))
// posPossibleVer2Plu = i;

}

Expand All @@ -165,7 +165,9 @@ else if (hasUnambiguouslyPersonAndNumber(tokens[i], "2", "SIN")) {
ruleMatches.add(ruleMatchWrongVerb(tokens[posVer2Sin]));
} else if (posDu > 0 && !isNear(posPossibleVer2Sin, posDu) && !isQuotationMark(tokens[posDu-1])) {
final int plus1 = ((posDu + 1) == tokens.length) ? 0 : +1;
if (!verbDoesMatchPersonAndNumber(tokens[posDu-1], tokens[posDu+plus1], "2", "SIN")) {
if (!verbDoesMatchPersonAndNumber(tokens[posDu-1], tokens[posDu+plus1], "2", "SIN") &&
!tokens[posDu+plus1].hasPartialPosTag("VER:1:SIN:KJ2") && // "Wenn ich du wäre"
!tokens[posDu-1].hasPartialPosTag("VER:1:SIN:KJ2")) {
ruleMatches.add(ruleMatchWrongVerbSubject(tokens[posDu], finiteVerb));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
# File Encoding: UTF-8
# Format: fullform baseform postags (tab separated)
# POS tag information uses the Morphy format, see tagset.txt
Zusage Zusage SUB:NOM:SIN:FEM
Zusage Zusage SUB:GEN:SIN:FEM
Zusage Zusage SUB:DAT:SIN:FEM
Zusage Zusage SUB:AKK:SIN:FEM
Zusagen Zusage SUB:NOM:PLU:FEM
Zusagen Zusage SUB:GEN:PLU:FEM
Zusagen Zusage SUB:DAT:PLU:FEM
Zusagen Zusage SUB:AKK:PLU:FEM
Regen Regen SUB:NOM:PLU:MAS
Regen Regen SUB:GEN:PLU:MAS
Regen Regen SUB:DAT:PLU:MAS
Regen Regen SUB:AKK:PLU:MAS
Typen Typ SUB:GEN:SIN:MAS
Typen Typ SUB:DAT:SIN:MAS
Typen Typ SUB:AKK:SIN:MAS
Integer Integer SUB:NOM:SIN:MAS
Integers Integer SUB:GEN:SIN:MAS
Integer Integer SUB:DAT:SIN:MAS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3428,7 +3428,7 @@ $Id$
</rule>
<rule id="DIES_DIE" name="Möglicher Tippfehler: 'dies (die)">
<pattern>
<token negate_pos="yes" postag_regexp="yes" postag="VER:[123].*"/>
<token><exception postag_regexp="yes" postag="VER:[123].*"/></token>
<marker>
<token>dies</token>
</marker>
Expand All @@ -3438,6 +3438,7 @@ $Id$
<message>Meinten Sie <suggestion>die</suggestion>?</message>
<example type="correct">Als er die Kritik äußerte, rief <marker>dies</marker> Kritik hervor.</example>
<example type="correct"><marker>Die</marker> ersten beiden Zuweisungen sind korrekt.</example>
<example type="correct">Zum großen Teil waren <marker>dies</marker> Krebsvorstufen.</example>
<!-- TODO warum ist "beiden" nicht als ADJ:SFT getagged? -->
<example type="incorrect" correction="Die"><marker>Dies</marker> ersten beiden Zuweisungen sind korrekt.</example>
</rule>
Expand Down Expand Up @@ -16780,16 +16781,18 @@ $Id$
</rule>
<rule>
<pattern case_sensitive="yes">
<token><exception>,</exception></token>
<token postag="ART.*GEN.*MAS.*" postag_regexp="yes"/>
<marker>
<token regexp="yes">montags|dienstags|mittwochs|donnerstags|freitags|samstags|sonntags</token>
</marker>
</pattern>
<message>&subanfang;<suggestion><match no="2" case_conversion="startupper"/></suggestion>&subende;</message>
<message>&subanfang;<suggestion><match no="3" case_conversion="startupper"/></suggestion>&subende;</message>
<short>&prgk;.</short>
<example type="incorrect" correction="Montags">Der Laden hat des <marker>montags</marker> geschlossen.</example>
<example type="correct">Der Laden hat des <marker>Montags</marker> geschlossen.</example>
<example type="correct">Der Laden hat <marker>montags</marker> geschlossen.</example>
<example type="correct">Der Laden, der <marker>montags</marker> geschlossen ist, ist weg.</example>
<example type="incorrect" correction="Dienstags">Eines <marker>dienstags</marker> kam er wieder zur Arbeit.</example>
<example type="incorrect" correction="Sonntags">Er hat eines <marker>sonntags</marker> den Zug verpasst.</example>
</rule>
Expand Down Expand Up @@ -18089,6 +18092,7 @@ $Id$
</rule>
<rule>
<pattern case_sensitive="yes">
<token><exception postag_regexp="yes" postag=".*GEN.*"/></token>
<marker>
<token>wegen</token>
</marker>
Expand All @@ -18098,6 +18102,7 @@ $Id$
<short>&prgk;.</short>
<example type="incorrect" correction="Wegen">Viel Glück und viel Segen auf all deinen <marker>wegen</marker>.</example>
<example type="correct">Viel Glück und viel Segen auf all deinen <marker>Wegen</marker>.</example>
<example type="correct">Sie tat es des Geldes <marker>wegen</marker>.</example>
</rule>
</rulegroup>
<rulegroup id="AUF_SCHRITT_UND_TRITT" name="Groß-/Kleinschreibung: 'auf Schritt und Tritt'">
Expand Down Expand Up @@ -23552,7 +23557,7 @@ $Id$
<rule>
<pattern case_sensitive="yes">
<token postag="VER:AUX.+" postag_regexp="yes" inflected="yes" skip="4">haben<exception scope="next" postag="SENT_END"/></token>
<token postag="VER:INF:.+" postag_regexp="yes"/>
<token postag="VER:INF:.+" postag_regexp="yes" regexp="yes">[a-zöäü].*</token>
<marker>
<token regexp="yes">gesehen|gelassen</token>
</marker>
Expand All @@ -23562,6 +23567,7 @@ $Id$
<url>http://www.magazin.institut1.de/690_Sprache_heissen_machen_lassen_als_Hilfsverben.html</url>
<short>Evt. Ersatzinfinitiv statt Partizip Perfekt erforderlich.</short>
<example type="correct">Ich habe es kommen <marker>sehen</marker>.</example>
<example type="correct">Ich habe die Übertragung im Fernsehen <marker>gesehen</marker>.</example>
<example type="incorrect" correction="sehen">Ich habe es schon lange kommen <marker>gesehen</marker>.</example>
<example type="incorrect" correction="sehen">Ich habe es ja kommen <marker>gesehen</marker>.</example>
<example type="incorrect" correction="lassen">Ich habe dich am ausgestreckten Arm verhungern <marker>gelassen</marker>.</example>
Expand Down Expand Up @@ -24775,37 +24781,41 @@ $Id$
<example type="incorrect" correction="Kaisers">Des <marker>Kaiser's</marker> neue Kleider.</example>
<example type="incorrect" correction="Müllers">Das Wandern ist des <marker>Müller’s</marker> Lust.</example>
</rule>
<rule>
<!-- <rule> TODO zu viele Fehlalarme bei Eigennamen
<pattern>
<marker>
<token postag="EIG:.*" postag_regexp="yes" regexp="yes">.*(ss|ß|tz|z|x|ce|cz|ć)<exception>Greenpeace</exception></token>
</marker>
<token postag="SUB:.*" postag_regexp="yes"/>
<token postag="SUB:.*"><exception regexp="yes">[Aa-ZzÄÖÜäöü]</exception><exception postag="EIG:.*" postag_regexp="yes"/></token>
</pattern>
<message>Handelt es sich um einen Genitiv? Wörter auf -s usw. enden im Genitiv mit einem Apostroph.</message>
<message>Handelt es sich um einen Genitiv? Wörter, die mit einem S-Laut enden, werden im Genitiv mit einem Apostroph markiert.</message>
<suggestion>\1’</suggestion>
<url>http://www.korrekturen.de/regelwerk/zeichensetzung4.shtml#P96</url>
<short>Wörter auf -s usw. enden im Genitiv mit einem Apostroph.</short>
<example type="correct"><marker>Wagners</marker> Musik</example>
<example type="correct"><marker>Grass’</marker> Blechtrommel</example>
<example type="correct">Hans <marker>Sachs’</marker> Gedichte</example>
<example type="correct"><marker>Schultheiß’</marker> Pläne</example>
<example type="correct"><marker>Strauß’</marker> Politik</example>
<example type="correct"><marker>Max</marker> Lenz</example>
<example type="correct"><marker>Max</marker> A. ist nett.</example>
<example type="incorrect" correction="Grass’"><marker>Grass</marker> Blechtrommel</example>
<example type="incorrect" correction="Schultheiß’"><marker>Schultheiß</marker> Pläne</example>
<example type="incorrect" correction="Schultheiß’"><marker>Schultheiß</marker> Pläne</example>-->
<!--
können wir nicht rausfinden, ohne bei "Wagners Musik" einen Fehlalarm zu haben:
<example type="incorrect" correction="Sachs’"><marker>Sachs</marker> Gedichte</example>
Strauß kein Eigenname:
<example type="incorrect" correction="Strauß’"><marker>Strauß</marker> Politik</example>
-->
</rule>
<!-- </rule> -->
<rule>
<pattern>
<token negate="yes" regexp="yes">'|’</token>
<marker>
<token postag="SUB:.*" postag_regexp="yes" regexp="yes">.*(s|ß|tz|z|x|ce|cz|ć)</token>
<token regexp="yes">'|’</token>
<token regexp="yes" spacebefore="no">'|’</token>
</marker>
<token negate="yes" regexp="yes">schen?</token>
</pattern>
<message>Sofern es sich nicht um einen Eigennamen handelt, wird der Genitiv normalerweise nicht mit einem Apostroph gekennzeichnet.</message>
<suggestion><match no="2" postag_regexp="yes" postag="(.*):(DAT|NOM|AKK):(.*)" postag_replace="$1:GEN:$3" /></suggestion>
Expand All @@ -24815,6 +24825,7 @@ $Id$
<example type="correct">Hans <marker>Sachs’</marker> Gedichte</example>
<example type="correct"><marker>Schultheiß’</marker> Pläne</example>
<example type="correct">Das nennt die Regierung jetzt '<marker>Versorgungsgesetz'</marker>.</example>
<example type="correct">Die <marker>Lenz'</marker>sche Regel ist wichtig.</example>
<example type="triggers_error"><marker>Strauß’</marker> Politik</example>
<example type="incorrect" correction="Zirkus">Der Direktor des <marker>Zirkus'</marker> Krone</example>
<example type="incorrect" correction="Hauses">Der Direktor des <marker>Haus'</marker> Krone</example>
Expand Down Expand Up @@ -25861,7 +25872,7 @@ $Id$
</rule>
<rule>
<pattern>
<token regexp="yes" negate="yes" negate_pos="yes" postag="SENT_START">&nbsp;|&nnbsp;|&thinsp;|&klamauf;|&anfauf;|[a-zäöü]</token>
<token regexp="yes" negate="yes" negate_pos="yes" postag="SENT_START">&nbsp;|&nnbsp;|&thinsp;|&klamauf;|&anfauf;|[a-zäöü]|.*\+</token>
<marker>
<token spacebefore="no">…</token>
</marker>
Expand All @@ -25873,6 +25884,7 @@ $Id$
<example type="correct">Er geht nach Hause&nbsp;…</example>
<example type="correct">Du bist ein A…!</example>
<example type="correct">… Nein.</example>
<example type="correct">(A+B+<marker>…</marker>+Z)</example>
<example type="incorrect" correction="&nbsp;…">Er geht nach Hause<marker>…</marker></example>
</rule>
</rulegroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ public void testWrongVerbSubject() throws IOException {
assertGood("Wobei wir benutzt haben, dass der Satz gilt.");
assertGood("Wünschst du dir mehr Zeit?");
assertGood("Wyrjtjbst du?"); // make sure that "UNKNOWN" is handled correctly
assertGood("Wenn ich du wäre, würde ich das nicht machen.");
// assertGood("Angenommen, du wärst ich."); TODO
// assertGood("Ich denke, dass das Haus, in das er gehen will, heute Morgen gestrichen worden ist."); TODO
// incorrect sentences:
assertBad("Auch morgen leben du.");
assertBad("Auch morgen leben du"); // do not segfault because "du" is the last token
Expand Down

0 comments on commit eacee98

Please sign in to comment.