Package cc.mallet.types

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


  {
    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();
    MEMM memm = new MEMM (inputAlphabet, outputAlphabet);
    String[] stateNames = new String[numStates];
    for (int i = 0; i < numStates; i++)
      stateNames[i] = "state" + i;
View Full Code Here


    // 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();
    // Store the dictionary
    if (outputAlphabet == null) {
      System.err.println("Output dictionary null.");
    }
View Full Code Here

          target.add(tokens[l][nFeatures]);
        }
        else nFeatures = tokens[l].length;
        ArrayList<Integer> featureIndices = new ArrayList<Integer>();
        for (int f = 0; f < nFeatures; f++) {
          int featureIndex = features.lookupIndex(tokens[l][f]);
          // gdruck
          // If the data alphabet's growth is stopped, featureIndex
          // will be -1.  Ignore these features.
          if (featureIndex >= 0) {
            featureIndices.add(featureIndex);
View Full Code Here

  public void testEstimating ()
  {
    Alphabet dict = new Alphabet ();
    Multinomial.Estimator e = new Multinomial.LaplaceEstimator (dict);
    FeatureSequence fs = new FeatureSequence (dict);
    fs.add (dict.lookupIndex ("a"));
    fs.add (dict.lookupIndex ("n"));
    fs.add (dict.lookupIndex ("d"));
    fs.add (dict.lookupIndex ("r"));
    fs.add (dict.lookupIndex ("e"));
    fs.add (dict.lookupIndex ("w"));
View Full Code Here

  {
    Alphabet dict = new Alphabet ();
    Multinomial.Estimator e = new Multinomial.LaplaceEstimator (dict);
    FeatureSequence fs = new FeatureSequence (dict);
    fs.add (dict.lookupIndex ("a"));
    fs.add (dict.lookupIndex ("n"));
    fs.add (dict.lookupIndex ("d"));
    fs.add (dict.lookupIndex ("r"));
    fs.add (dict.lookupIndex ("e"));
    fs.add (dict.lookupIndex ("w"));
    fs.add (dict.lookupIndex ("m"));
View Full Code Here

    Alphabet dict = new Alphabet ();
    Multinomial.Estimator e = new Multinomial.LaplaceEstimator (dict);
    FeatureSequence fs = new FeatureSequence (dict);
    fs.add (dict.lookupIndex ("a"));
    fs.add (dict.lookupIndex ("n"));
    fs.add (dict.lookupIndex ("d"));
    fs.add (dict.lookupIndex ("r"));
    fs.add (dict.lookupIndex ("e"));
    fs.add (dict.lookupIndex ("w"));
    fs.add (dict.lookupIndex ("m"));
    fs.add (dict.lookupIndex ("c"));
View Full Code Here

    Multinomial.Estimator e = new Multinomial.LaplaceEstimator (dict);
    FeatureSequence fs = new FeatureSequence (dict);
    fs.add (dict.lookupIndex ("a"));
    fs.add (dict.lookupIndex ("n"));
    fs.add (dict.lookupIndex ("d"));
    fs.add (dict.lookupIndex ("r"));
    fs.add (dict.lookupIndex ("e"));
    fs.add (dict.lookupIndex ("w"));
    fs.add (dict.lookupIndex ("m"));
    fs.add (dict.lookupIndex ("c"));
    fs.add (dict.lookupIndex ("c"));
View Full Code Here

    FeatureSequence fs = new FeatureSequence (dict);
    fs.add (dict.lookupIndex ("a"));
    fs.add (dict.lookupIndex ("n"));
    fs.add (dict.lookupIndex ("d"));
    fs.add (dict.lookupIndex ("r"));
    fs.add (dict.lookupIndex ("e"));
    fs.add (dict.lookupIndex ("w"));
    fs.add (dict.lookupIndex ("m"));
    fs.add (dict.lookupIndex ("c"));
    fs.add (dict.lookupIndex ("c"));
    fs.add (dict.lookupIndex ("a"));
View Full Code Here

    fs.add (dict.lookupIndex ("a"));
    fs.add (dict.lookupIndex ("n"));
    fs.add (dict.lookupIndex ("d"));
    fs.add (dict.lookupIndex ("r"));
    fs.add (dict.lookupIndex ("e"));
    fs.add (dict.lookupIndex ("w"));
    fs.add (dict.lookupIndex ("m"));
    fs.add (dict.lookupIndex ("c"));
    fs.add (dict.lookupIndex ("c"));
    fs.add (dict.lookupIndex ("a"));
    fs.add (dict.lookupIndex ("l"));
View Full Code Here

    fs.add (dict.lookupIndex ("n"));
    fs.add (dict.lookupIndex ("d"));
    fs.add (dict.lookupIndex ("r"));
    fs.add (dict.lookupIndex ("e"));
    fs.add (dict.lookupIndex ("w"));
    fs.add (dict.lookupIndex ("m"));
    fs.add (dict.lookupIndex ("c"));
    fs.add (dict.lookupIndex ("c"));
    fs.add (dict.lookupIndex ("a"));
    fs.add (dict.lookupIndex ("l"));
    fs.add (dict.lookupIndex ("l"));
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.