Example usage for edu.stanford.nlp.util Index indexOf

List of usage examples for edu.stanford.nlp.util Index indexOf

Introduction

In this page you can find the example usage for edu.stanford.nlp.util Index indexOf.

Prototype

int indexOf(E o);

Source Link

Document

Returns the integer index of the Object in the Index or -1 if the Object is not already in the Index.

Usage

From source file:conditionalCFG.ConditionalCFGParser.java

License:Open Source License

public ConditionalCFGParser(BinaryGrammar bg, UnaryGrammar ug, ConditionalLexicon lex, Options op,
        Index<String> stateIndex, Index<String> wordIndex, Index<String> tagIndex) {
    //    System.out.println("ExhaustivePCFGParser constructor called.");
    this.bg = bg;
    this.ug = ug;
    this.lex = lex;
    this.op = op;
    this.tlp = op.langpack();
    goalStr = tlp.startSymbol();/*from   w w  w .  java  2 s  .c o  m*/
    this.stateIndex = stateIndex;
    this.wordIndex = wordIndex;
    this.tagIndex = tagIndex;
    tf = new LabeledScoredTreeFactory();

    numStates = stateIndex.size();
    isTag = new boolean[numStates];
    // tag index is smaller, so we fill by iterating over the tag index
    // rather than over the state index
    for (String tag : tagIndex.objectsList()) {
        int state = stateIndex.indexOf(tag);
        if (state < 0) {
            continue;
        }
        isTag[state] = true;
    }
}