Examples of lookupIndex()


Examples of cc.mallet.types.Alphabet.lookupIndex()

  }

  private Alphabet getTransitionAlphabet() {
    Alphabet transitionAlphabet = new Alphabet();
    for (int i = 0; i < numStates(); i++)
      transitionAlphabet.lookupIndex(getState(i).getName(), true);
    return transitionAlphabet;
  }

  @Deprecated
  public void reset() {
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

      transitionEstimator = new Multinomial.LaplaceEstimator[numStates()];
      emissionMultinomial = new Multinomial[numStates()];
      transitionMultinomial = new Multinomial[numStates()];
      Alphabet transitionAlphabet = new Alphabet();
      for (int i = 0; i < numStates(); i++)
        transitionAlphabet.lookupIndex(((State) states.get(i))
            .getName(), true);
      for (int i = 0; i < numStates(); i++) {
        emissionEstimator[i] = new Multinomial.LaplaceEstimator(
            inputAlphabet);
        transitionEstimator[i] = new Multinomial.LaplaceEstimator(
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  public void testGetSetParameters() {
    int inputVocabSize = 100;
    int numStates = 5;
    Alphabet inputAlphabet = new Alphabet();
    for (int i = 0; i < inputVocabSize; i++)
      inputAlphabet.lookupIndex("feature" + i);
    Alphabet outputAlphabet = new Alphabet();
    CRF crf = new CRF(inputAlphabet, outputAlphabet);
    String[] stateNames = new String[numStates];
    for (int i = 0; i < numStates; i++)
      stateNames[i] = "state" + i;
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  public void testSumLattice() {
    int inputVocabSize = 1;
    int numStates = 2;
    Alphabet inputAlphabet = new Alphabet();
    for (int i = 0; i < inputVocabSize; i++)
      inputAlphabet.lookupIndex("feature" + i);
    Alphabet outputAlphabet = new Alphabet();

    CRF crf = new CRF(inputAlphabet, outputAlphabet);

    String[] stateNames = new String[numStates];
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  public void testMaxLattice() {
    int inputVocabSize = 1;
    int numStates = 2;
    Alphabet inputAlphabet = new Alphabet();
    for (int i = 0; i < inputVocabSize; i++)
      inputAlphabet.lookupIndex("feature" + i);
    Alphabet outputAlphabet = new Alphabet();

    CRF crf = new CRF(inputAlphabet, outputAlphabet);

    String[] stateNames = new String[numStates];
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

    // Create a file to store the CRF
    File f = new File("TestObject.obj");
    File f2 = new File("TestObject2.obj");
    Alphabet inputAlphabet = new Alphabet();
    for (int i = 0; i < inputVocabSize; i++)
      inputAlphabet.lookupIndex("feature" + i);
    Alphabet outputAlphabet = new Alphabet();
    String[] stateNames = new String[numStates];
    for (int i = 0; i < numStates; i++) {
      stateNames[i] = "state" + i;
      outputAlphabet.lookupIndex(stateNames[i]);
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

      inputAlphabet.lookupIndex("feature" + i);
    Alphabet outputAlphabet = new Alphabet();
    String[] stateNames = new String[numStates];
    for (int i = 0; i < numStates; i++) {
      stateNames[i] = "state" + i;
      outputAlphabet.lookupIndex(stateNames[i]);
    }

    CRF crf = new CRF(inputAlphabet, outputAlphabet);
    CRF saveCRF = crf;
    // inputAlphabet = (Feature.Alphabet) crf.getInputAlphabet();
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

 
  public void testNewPutSizeFreeze ()
  {
    Alphabet dict = new Alphabet ();
    FeatureSequence fs = new FeatureSequence (dict, 10);
    fs.add (dict.lookupIndex ("apple"));
    fs.add (dict.lookupIndex ("bear"));
    fs.add (dict.lookupIndex ("car"));
    fs.add (dict.lookupIndex ("door"));
    assertTrue (fs.size() == 4);
    double[] weights = new double[4];
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  public void testNewPutSizeFreeze ()
  {
    Alphabet dict = new Alphabet ();
    FeatureSequence fs = new FeatureSequence (dict, 10);
    fs.add (dict.lookupIndex ("apple"));
    fs.add (dict.lookupIndex ("bear"));
    fs.add (dict.lookupIndex ("car"));
    fs.add (dict.lookupIndex ("door"));
    assertTrue (fs.size() == 4);
    double[] weights = new double[4];
    fs.addFeatureWeightsTo (weights);
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  {
    Alphabet dict = new Alphabet ();
    FeatureSequence fs = new FeatureSequence (dict, 10);
    fs.add (dict.lookupIndex ("apple"));
    fs.add (dict.lookupIndex ("bear"));
    fs.add (dict.lookupIndex ("car"));
    fs.add (dict.lookupIndex ("door"));
    assertTrue (fs.size() == 4);
    double[] weights = new double[4];
    fs.addFeatureWeightsTo (weights);
    assertTrue (weights[1] == 1.0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.