You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jk...@apache.org on 2012/03/17 02:54:16 UTC
svn commit: r1301853 -
/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/Dictionary.java
Author: jkosin
Date: Sat Mar 17 01:54:16 2012
New Revision: 1301853
URL: http://svn.apache.org/viewvc?rev=1301853&view=rev
Log:
OPENNLP-471: added min and max token counts to dictionary to hold token counts (for shortest and longest) stored in the dictonary.
Modified:
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/Dictionary.java
Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/Dictionary.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/Dictionary.java?rev=1301853&r1=1301852&r2=1301853&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/Dictionary.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/Dictionary.java Sat Mar 17 01:54:16 2012
@@ -92,6 +92,8 @@ public class Dictionary implements Itera
private Set<StringListWrapper> entrySet = new HashSet<StringListWrapper>();
private final boolean isCaseSensitive;
+ private int minTokenCount = 99999;
+ private int maxTokenCount = 0;
/**
@@ -146,6 +148,24 @@ public class Dictionary implements Itera
*/
public void put(StringList tokens) {
entrySet.add(new StringListWrapper(tokens));
+ minTokenCount = Math.min(minTokenCount, tokens.size());
+ maxTokenCount = Math.max(maxTokenCount, tokens.size());
+ }
+
+ /**
+ *
+ * @return minimum token count in the dictionary
+ */
+ public int getMinTokenCount() {
+ return minTokenCount;
+ }
+
+ /**
+ *
+ * @return maximum token count in the dictionary
+ */
+ public int getMaxTokenCount() {
+ return maxTokenCount;
}
/**