Revision: 7374 http://languagetool.svn.sourceforge.net/languagetool/?rev=7374&view=rev Author: dnaber Date: 2012-06-16 22:30:53 +0000 (Sat, 16 Jun 2012) Log Message: ----------- [de] fix: order of POS tags was important sometimes
Modified Paths: -------------- trunk/JLanguageTool/src/java/org/languagetool/AnalyzedTokenReadings.java trunk/JLanguageTool/src/java/org/languagetool/rules/de/CaseRule.java Modified: trunk/JLanguageTool/src/java/org/languagetool/AnalyzedTokenReadings.java =================================================================== --- trunk/JLanguageTool/src/java/org/languagetool/AnalyzedTokenReadings.java 2012-06-16 21:33:39 UTC (rev 7373) +++ trunk/JLanguageTool/src/java/org/languagetool/AnalyzedTokenReadings.java 2012-06-16 22:30:53 UTC (rev 7374) @@ -126,6 +126,24 @@ } /** + * Checks if one of the token's readings has a particular lemma. + * + * @param lemma lemma POS tag to look for + */ + public final boolean hasLemma(final String lemma) { + boolean found = false; + for (final AnalyzedToken reading : anTokReadings) { + if (reading.getLemma() != null) { + found = lemma.equals(reading.getLemma()); + if (found) { + break; + } + } + } + return found; + } + + /** * Checks if the token has a particular POS tag, whereas a part of the given POS tag needs to match. * * @param posTag POS tag substring to look for Modified: trunk/JLanguageTool/src/java/org/languagetool/rules/de/CaseRule.java =================================================================== --- trunk/JLanguageTool/src/java/org/languagetool/rules/de/CaseRule.java 2012-06-16 21:33:39 UTC (rev 7373) +++ trunk/JLanguageTool/src/java/org/languagetool/rules/de/CaseRule.java 2012-06-16 22:30:53 UTC (rev 7374) @@ -391,7 +391,7 @@ boolean prevTokenIsDas = false; for (int i = 0; i < tokens.length; i++) { - //FIXME: defaulting to the first analysis don't know if it's safe + //Note: defaulting to the first analysis is only save if we only query for sentence start final String posToken = tokens[i].getAnalyzedToken(0).getPOSTag(); if (posToken != null && posToken.equals(JLanguageTool.SENTENCE_START_TAGNAME)) { continue; @@ -411,7 +411,7 @@ AnalyzedGermanTokenReadings analyzedGermanToken2; boolean isBaseform = false; - if (analyzedToken.getReadingsLength() >= 1 && token.equals(analyzedToken.getAnalyzedToken(0).getLemma())) { + if (analyzedToken.getReadingsLength() >= 1 && analyzedToken.hasLemma(token)) { isBaseform = true; } if ((readings == null || analyzedToken.getAnalyzedToken(0).getPOSTag() == null || analyzedToken.hasReadingOfType(GermanToken.POSType.VERB)) 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