Package opennlp.tools.util

Examples of opennlp.tools.util.CountedSet


  public MutableDictionary(int cutoff) {
    super();
    this.cutoff = cutoff;
    wordMap = new CountedNumberedSet();
    nGramFactory = new NGramFactory(wordMap);
    gramSet = new CountedSet();
    wordCounts = new ArrayList();
  }
View Full Code Here


    this.cutoff = cutoff;
  }

  protected void loadGrams(DataInputStream input) throws IOException {
    int numGrams = input.readInt();
    CountedSet cgramSet = new CountedSet(numGrams);
    for (int gi=0;gi<numGrams;gi++) {
      int gramLength=input.readInt();
      int[] words = new int[gramLength];
      for (int wi=0;wi<gramLength;wi++) {
        words[wi]=input.readInt();
      }
      cgramSet.setCount(new NGram(words),cutoff);
    }
    gramSet = cgramSet;
  }
View Full Code Here

    for (Iterator ki=wordMap.iterator();ki.hasNext();) {
      String key = (String) ki.next();
      output.writeUTF(key);
      output.writeInt(wordMap.getIndex(key));
    }
    CountedSet cset = (CountedSet) gramSet;
    int gramCount = 0;
    for (Iterator gi = gramSet.iterator();gi.hasNext();) {
      NGram ngram = (NGram) gi.next();
      if (cset.getCount(ngram) >= cutoff) {
        int[] words = ngram.getWords();
        output.writeInt(words.length);
        for (int wi=0;wi<words.length;wi++) {
          output.writeInt(words[wi]);
        }
View Full Code Here

  private String newline = System.getProperty("line.separator");
 
  public POSDictionaryWriter(String file) throws IOException {
    dictFile = new FileWriter(file);
    dictionary = new HashMap();
    wordCounts = new CountedSet();
  }
View Full Code Here

 

  public AbstractResolver(int neb) {
    numEntitiesBack=neb;
    showExclusions = true;
    distances = new CountedSet();
  }
View Full Code Here

TOP

Related Classes of opennlp.tools.util.CountedSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.