Example usage for edu.stanford.nlp.process WordShapeClassifier WORDSHAPECHRIS2

List of usage examples for edu.stanford.nlp.process WordShapeClassifier WORDSHAPECHRIS2

Introduction

In this page you can find the example usage for edu.stanford.nlp.process WordShapeClassifier WORDSHAPECHRIS2.

Prototype

int WORDSHAPECHRIS2

To view the source code for edu.stanford.nlp.process WordShapeClassifier WORDSHAPECHRIS2.

Click Source Link

Usage

From source file:org.jdmp.stanfordpos.StanfordTagger.java

License:Open Source License

public void train(ListMatrix<ListMatrix<MapMatrix<String, String>>> listMatrix) throws Exception {
    List<List<CoreLabel>> sentenceList = new ArrayList<List<CoreLabel>>();
    for (ListMatrix<MapMatrix<String, String>> innerList : listMatrix) {
        List<CoreLabel> tokenList = new ArrayList<CoreLabel>();
        sentenceList.add(tokenList);/*w  w w  .jav  a 2 s.c  om*/
        for (MapMatrix<String, String> mapMatrix : innerList) {
            CoreLabel l = new CoreLabel();
            l.set(CoreAnnotations.TextAnnotation.class, mapMatrix.getAsString("Token"));
            l.set(CoreAnnotations.AnswerAnnotation.class, mapMatrix.getAsString("Class"));
            tokenList.add(l);
        }
    }

    SeqClassifierFlags flags = new SeqClassifierFlags();
    flags.maxLeft = 3;
    flags.useClassFeature = true;
    flags.useWord = true;
    flags.maxNGramLeng = 6;
    flags.usePrev = true;
    flags.useNext = true;
    flags.useDisjunctive = true;
    flags.useSequences = true;
    flags.usePrevSequences = true;
    flags.useTypeSeqs = true;
    flags.useTypeSeqs2 = true;
    flags.useTypeySequences = true;
    flags.wordShape = WordShapeClassifier.WORDSHAPECHRIS2;

    flags.useNGrams = true;
    crf = new CRFClassifier<CoreLabel>(flags);
    crf.train(sentenceList, null);
}