Package edu.stanford.nlp.classify

Examples of edu.stanford.nlp.classify.WeightedDataset


  @Override
  public void finishTraining() {
    IntCounter<String> tagCounter = new IntCounter<String>();

    WeightedDataset data = new WeightedDataset(datumCounter.size());

    for (TaggedWord word : datumCounter.keySet()) {
      int count = datumCounter.getIntCount(word);
      if (trainOnLowCount && count > trainCountThreshold) {
        continue;
      }
      if (functionWordTags.containsKey(word.word())) {
        continue;
      }
      tagCounter.incrementCount(word.tag());
      if (trainByType) {
        count = 1;
      }
      data.add(new BasicDatum(featExtractor.makeFeatures(word.word()), word.tag()), count);
    }
    datumCounter = null;

    tagDist = Distribution.laplaceSmoothedDistribution(tagCounter, tagCounter.size(), 0.5);
    tagCounter = null;
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.classify.WeightedDataset

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.