Codota Logo
opennlp.tools.ml.model
Code IndexAdd Codota to your IDE (free)

How to use opennlp.tools.ml.model

Best Java code snippets using opennlp.tools.ml.model (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: apache/opennlp

public AbstractModel(Context[] params, String[] predLabels, String[] outcomeNames) {
 init(predLabels, params, outcomeNames);
 this.evalParams = new EvalParameters(params, outcomeNames.length);
}
origin: apache/opennlp

/**
 * Retrieves an array of all possible part-of-speech tags from the
 * tagger.
 *
 * @return String[]
 */
public String[] getAllPosTags() {
 return model.getOutcomes();
}
origin: apache/opennlp

 @Override
 public void writeUTF(String s) throws IOException {
  delegateWriter.writeUTF(s);
 }
}
origin: apache/opennlp

private Event createEvent(String obs) {
 int lastSpace = obs.lastIndexOf(' ');
 if (lastSpace == -1)
  return null;
 else {
  String[] contexts = obs.substring(0,lastSpace).split("\\s+");
  float[] values = RealValueFileEventStream.parseContexts(contexts);
  return new Event(obs.substring(lastSpace + 1),contexts,values);
 }
}
origin: apache/opennlp

 @Override
 public String[] getOutcomes() {
  String[] outcomes = new String[model.getNumOutcomes()];

  for (int i = 0; i < model.getNumOutcomes(); i++) {
   outcomes[i] = model.getOutcome(i);
  }

  return outcomes;
 }
}
origin: apache/opennlp

public AbstractModel create(InputStream in) throws IOException {
 return new GenericModelReader(new BinaryFileDataReader(in)).getModel();
}
origin: apache/opennlp

protected double[] initOutcomeTotals(String[] outcomeNames, Context[] params) {
 double[] outcomeTotals = new double[outcomeNames.length];
 for (int i = 0; i < params.length; ++i) {
  Context context = params[i];
  for (int j = 0; j < context.getOutcomes().length; ++j) {
   int outcome = context.getOutcomes()[j];
   double count = context.getParameters()[j];
   outcomeTotals[outcome] += count;
  }
 }
 return outcomeTotals;
}
origin: apache/opennlp

protected String[] getPredicates() throws java.io.IOException {
 NUM_PREDS = readInt();
 String[] predLabels = new String[NUM_PREDS];
 for (int i = 0; i < NUM_PREDS; i++)
   predLabels[i] = readUTF();
 return predLabels;
}
origin: apache/opennlp

 public Sequence[] topKLemmaClasses(String[] sentence, String[] tags, double minSequenceScore) {
  return model.bestSequences(DEFAULT_BEAM_SIZE, sentence, new Object[] { tags }, minSequenceScore,
    contextGenerator, sequenceValidator);
 }
}
origin: apache/opennlp

/**
 * Constructor which directly instantiates the DataInputStream containing
 * the model contents.
 *
 * @param dis The DataInputStream containing the model information.
 */
public BinaryNaiveBayesModelReader(DataInputStream dis) {
 super(new BinaryFileDataReader(dis));
}
origin: apache/opennlp

/**
 * Constructor which directly instantiates the BufferedReader containing
 * the model contents.
 *
 * @param br The BufferedReader containing the model information.
 */
public PlainTextNaiveBayesModelReader(BufferedReader br) {
 super(new PlainTextFileDataReader(br));
}
origin: apache/opennlp

/**
 * Implement as needed for the format the model is stored in.
 */
public double readDouble() throws java.io.IOException {
 return dataReader.readDouble();
}
origin: apache/opennlp

protected AbstractModel(Context[] params, String[] predLabels,
  Map<String, Context> pmap, String[] outcomeNames) {
 this.pmap = pmap;
 this.outcomeNames =  outcomeNames;
 this.evalParams = new EvalParameters(params,outcomeNames.length);
}
origin: apache/opennlp

/**
 * Implement as needed for the format the model is stored in.
 */
public String readUTF() throws java.io.IOException {
 return dataReader.readUTF();
}
origin: apache/opennlp

@Override
public void writeDouble(double d) throws IOException {
 delegateWriter.writeDouble(d);
}
origin: apache/opennlp

@Override
public void persist() throws IOException {
 delegateWriter.persist();
}
origin: apache/opennlp

/**
 * Implement as needed for the format the model is stored in.
 */
public int readInt() throws java.io.IOException {
 return dataReader.readInt();
}
origin: apache/opennlp

protected String[] getOutcomes() throws java.io.IOException {
 int numOutcomes = readInt();
 String[] outcomeLabels = new String[numOutcomes];
 for (int i = 0; i < numOutcomes; i++) outcomeLabels[i] = readUTF();
 return outcomeLabels;
}
origin: apache/opennlp

 /**
  * Constructor which directly instantiates the DataInputStream containing the
  * model contents.
  *
  * @param dis
  *          The DataInputStream containing the model information.
  */
 public BinaryGISModelReader(DataInputStream dis) {
  super(new BinaryFileDataReader(dis));
 }
}
origin: apache/opennlp

 /**
  * Constructor which directly instantiates the DataInputStream containing the
  * model contents.
  *
  * @param dis
  *          The DataInputStream containing the model information.
  */
 public BinaryQNModelReader(DataInputStream dis) {
  super(new BinaryFileDataReader(dis));
 }
}
opennlp.tools.ml.model

Most used classes

  • MaxentModel
    Interface for maximum entropy models.
  • Event
    The context of a decision point during training. This includes contextual predicates and an outcome.
  • SequenceClassificationModel
    A classification model that can label an input sequence.
  • AbstractModel
  • FileEventStream
    Class for using a file of events as an event stream. The format of the file is one event perline wit
  • TwoPassDataIndexer,
  • UniformPrior,
  • BinaryFileDataReader,
  • ComparableEvent,
  • Context,
  • DataIndexer,
  • DataIndexerFactory,
  • GenericModelReader,
  • GenericModelWriter,
  • HashSumEventStream,
  • OnePassRealValueDataIndexer,
  • PlainTextFileDataReader,
  • RealValueFileEventStream,
  • Sequence
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now