/** * Tags the unlabeled data and compares the part-of-speech tags with the labeled data, keeping * track of and reporting total accuracy at the end. */ public void testAccuracy() { WordForm __wordForm = new WordForm(); Parser labeledParser = new POSBracketToToken(labeledTestFile); int numSeen = 0; int numEqual = 0; Token labeledWord = (Token) labeledParser.next(); for (; labeledWord != null; labeledWord = (Token) labeledParser.next()) { String labeledTag = labeledWord.label; String testTag = tagger.discreteValue(labeledWord); if (labeledTag.equals(testTag)) { numEqual++; } numSeen++; } System.out.println("Total accuracy over " + numSeen + " items: " + String.format("%.2f", 100.0 * (double) numEqual / (double) numSeen) + "%"); }
/** * Tags the unlabeled data and compares the part-of-speech tags with the labeled data, keeping * track of and reporting total accuracy at the end. */ public void testAccuracy() { WordForm __wordForm = new WordForm(); Parser labeledParser = new POSBracketToToken(labeledTestFile); int numSeen = 0; int numEqual = 0; Token labeledWord = (Token) labeledParser.next(); for (; labeledWord != null; labeledWord = (Token) labeledParser.next()) { String labeledTag = labeledWord.label; String testTag = tagger.discreteValue(labeledWord); if (labeledTag.equals(testTag)) { numEqual++; } numSeen++; } System.out.println("Total accuracy over " + numSeen + " items: " + String.format("%.2f", 100.0 * (double) numEqual / (double) numSeen) + "%"); }
/** * Implements the program described above. * * @param args The command line parameters. **/ public static void main(String[] args) { // Parse the command line // if (args.length != 1) { // logger.error("usage: java edu.illinois.cs.cogcomp.lbj.pos.TestPOS <text file>"); // System.exit(1); // } // String testingFile = args[0]; ResourceManager rm = new POSConfigurator().getDefaultConfig(); String testingFile = rm.getString("testData"); TestDiscrete.testDiscrete(new TestDiscrete(), new POSTagger(), new POSLabel(), new POSBracketToToken(testingFile), true, 0); } }
/** * Implements the program described above. * * @param args The command line parameters. **/ public static void main(String[] args) { // Parse the command line // if (args.length != 1) { // logger.error("usage: java edu.illinois.cs.cogcomp.lbj.pos.TestPOS <text file>"); // System.exit(1); // } // String testingFile = args[0]; ResourceManager rm = new POSConfigurator().getDefaultConfig(); String testingFile = rm.getString("testData"); TestDiscrete.testDiscrete(new TestDiscrete(), new POSTagger(), new POSLabel(), new POSBracketToToken(testingFile), true, 0); } }
Parser trainingParser = new POSBracketToToken(trainingData); Parser trainingParserUnknown = new POSLabeledUnknownWordParser(trainingData);
Parser trainingParser = new POSBracketToToken(trainingData); Parser trainingParserUnknown = new POSLabeledUnknownWordParser(trainingData);