public TestSequenceModel(CRFCliqueTree<? extends CharSequence> cliqueTree, LabelDictionary labelDictionary, List<? extends CoreMap> document) { // this.factorTables = factorTables; this.cliqueTree = cliqueTree; // this.window = factorTables[0].windowSize(); this.window = cliqueTree.window(); // this.numClasses = factorTables[0].numClasses(); int numClasses = cliqueTree.getNumClasses(); this.backgroundTag = new int[] { cliqueTree.backgroundIndex() }; allTags = new int[numClasses]; for (int i = 0; i < allTags.length; i++) { allTags[i] = i; } if (labelDictionary != null) { // Constrained allowedTagsAtPosition = new int[document.size()][]; for (int i = 0; i < allowedTagsAtPosition.length; ++i) { CoreMap token = document.get(i); String observation = token.get(CoreAnnotations.TextAnnotation.class); allowedTagsAtPosition[i] = labelDictionary.isConstrained(observation) ? labelDictionary.getConstrainedSet(observation) : allTags; } } else { allowedTagsAtPosition = null; } }
public TestSequenceModel(CRFCliqueTree cliqueTree) { //this.factorTables = factorTables; this.cliqueTree = cliqueTree; //this.window = factorTables[0].windowSize(); this.window = cliqueTree.window(); //this.numClasses = factorTables[0].numClasses(); this.numClasses = cliqueTree.getNumClasses(); tags = new int[numClasses]; for (int i = 0; i < tags.length; i++) { tags[i] = i; } backgroundTag = new int[]{cliqueTree.backgroundIndex()}; }
public TestSequenceModel(CRFCliqueTree<String> cliqueTree, LabelDictionary labelDictionary, List<? extends CoreMap> document) { // this.factorTables = factorTables; this.cliqueTree = cliqueTree; // this.window = factorTables[0].windowSize(); this.window = cliqueTree.window(); // this.numClasses = factorTables[0].numClasses(); this.numClasses = cliqueTree.getNumClasses(); this.backgroundTag = new int[] { cliqueTree.backgroundIndex() }; allTags = new int[numClasses]; for (int i = 0; i < allTags.length; i++) { allTags[i] = i; } if (labelDictionary != null) { // Constrained allowedTagsAtPosition = new int[document.size()][]; for (int i = 0; i < allowedTagsAtPosition.length; ++i) { CoreMap token = document.get(i); String observation = token.get(CoreAnnotations.TextAnnotation.class); allowedTagsAtPosition[i] = labelDictionary.isConstrained(observation) ? labelDictionary.getConstrainedSet(observation) : allTags; } } }
public TestSequenceModel(CRFCliqueTree<? extends CharSequence> cliqueTree, LabelDictionary labelDictionary, List<? extends CoreMap> document) { // this.factorTables = factorTables; this.cliqueTree = cliqueTree; // this.window = factorTables[0].windowSize(); this.window = cliqueTree.window(); // this.numClasses = factorTables[0].numClasses(); int numClasses = cliqueTree.getNumClasses(); this.backgroundTag = new int[] { cliqueTree.backgroundIndex() }; allTags = new int[numClasses]; for (int i = 0; i < allTags.length; i++) { allTags[i] = i; } if (labelDictionary != null) { // Constrained allowedTagsAtPosition = new int[document.size()][]; for (int i = 0; i < allowedTagsAtPosition.length; ++i) { CoreMap token = document.get(i); String observation = token.get(CoreAnnotations.TextAnnotation.class); allowedTagsAtPosition[i] = labelDictionary.isConstrained(observation) ? labelDictionary.getConstrainedSet(observation) : allTags; } } else { allowedTagsAtPosition = null; } }