@Test public void testNumberOfGrams() throws Exception { NGramModel ngramModel = new NGramModel(); StringList tokens = new StringList("the", "bro", "wn"); ngramModel.add(tokens, 1, 3); Assert.assertEquals(6, ngramModel.numberOfGrams()); }
public int numberOfGrams() { int counter = 0; for (StringList ngram : this) { counter += getCount(ngram); } return counter; }
NGramModel implements Iterable<StringList> { public int numberOfGrams() { int counter = 0; for (StringList ngram : this) { counter += getCount(ngram); } return counter; } }
NGramModel implements Iterable<StringList> { public int numberOfGrams() { int counter = 0; for (StringList ngram : this) { counter += getCount(ngram); } return counter; } NGramModel();  NGramModel(InputStream in); }
NGramModel implements Iterable<StringList> { public int numberOfGrams() { int counter = 0; for (StringList ngram : this) { counter += getCount(ngram); } return counter; } NGramModel();  NGramModel(InputStream in); int getCount(StringList ngram); void setCount(StringList ngram, int count); void add(StringList ngram); void add(StringList ngram, int minLength, int maxLength); void add(CharSequence chars, int minLength, int maxLength); void remove(StringList tokens); boolean contains(StringList tokens); int size(); @Override Iterator<StringList> iterator(); int numberOfGrams(); void cutoff(int cutoffUnder, int cutoffOver); Dictionary toDictionary(); Dictionary toDictionary(boolean caseSensitive); void serialize(OutputStream out); @Override boolean equals(Object obj); @Override String toString(); @Override int hashCode(); }
NGramModel implements Iterable<StringList> { public int numberOfGrams() { int counter = 0; for (StringList ngram : this) { counter += getCount(ngram); } return counter; } NGramModel();  NGramModel(InputStream in); int getCount(StringList ngram); void setCount(StringList ngram, int count); void add(StringList ngram); void add(StringList ngram, int minLength, int maxLength); void add(CharSequence chars, int minLength, int maxLength); void remove(StringList tokens); boolean contains(StringList tokens); int size(); @Override Iterator<StringList> iterator(); int numberOfGrams(); void cutoff(int cutoffUnder, int cutoffOver); Dictionary toDictionary(); Dictionary toDictionary(boolean caseSensitive); void serialize(OutputStream out); @Override boolean equals(Object obj); @Override String toString(); @Override int hashCode();  }