@Test public void testPOSTagger() throws IOException { POSModel posModel = trainPOSModel(ModelType.MAXENT); POSTagger tagger = new POSTaggerME(posModel); String[] tags = tagger.tag(new String[] { "The", "driver", "got", "badly", "injured", "."}); Assert.assertEquals(6, tags.length); Assert.assertEquals("DT", tags[0]); Assert.assertEquals("NN", tags[1]); Assert.assertEquals("VBD", tags[2]); Assert.assertEquals("RB", tags[3]); Assert.assertEquals("VBN", tags[4]); Assert.assertEquals(".", tags[5]); }
public String[] tag(String[] sentence) { return this.tag(sentence, null); }
POSTaggerME implements POSTagger { public String[] tag(String[] sentence) { return this.tag(sentence, null); } }
POSTaggerME implements POSTagger { public String[] tag(String[] sentence) { return this.tag(sentence, null); } POSTaggerME(POSModel model); }
POSTaggerME implements POSTagger { public String[] tag(String[] sentence) { return this.tag(sentence, null); } POSTaggerME(POSModel model); String[] getAllPosTags(); String[] tag(String[] sentence); String[] tag(String[] sentence, Object[] additionaContext); String[][] tag(int numTaggings, String[] sentence); Sequence[] topKSequences(String[] sentence); Sequence[] topKSequences(String[] sentence, Object[] additionaContext); void probs(double[] probs); double[] probs(); String[] getOrderedTags(List<String> words, List<String> tags, int index); String[] getOrderedTags(List<String> words, List<String> tags, int index,double[] tprobs); static POSModel train(String languageCode,
      ObjectStream<POSSample> samples, TrainingParameters trainParams,
      POSTaggerFactory posFactory); static Dictionary buildNGramDictionary(ObjectStream<POSSample> samples, int cutoff); static void populatePOSDictionary(ObjectStream<POSSample> samples,
      MutableTagDictionary dict, int cutoff); }
POSTaggerME implements POSTagger { public String[] tag(String[] sentence) { return this.tag(sentence, null); } POSTaggerME(POSModel model); String[] getAllPosTags(); String[] tag(String[] sentence); String[] tag(String[] sentence, Object[] additionaContext); String[][] tag(int numTaggings, String[] sentence); Sequence[] topKSequences(String[] sentence); Sequence[] topKSequences(String[] sentence, Object[] additionaContext); void probs(double[] probs); double[] probs(); String[] getOrderedTags(List<String> words, List<String> tags, int index); String[] getOrderedTags(List<String> words, List<String> tags, int index,double[] tprobs); static POSModel train(String languageCode,
      ObjectStream<POSSample> samples, TrainingParameters trainParams,
      POSTaggerFactory posFactory); static Dictionary buildNGramDictionary(ObjectStream<POSSample> samples, int cutoff); static void populatePOSDictionary(ObjectStream<POSSample> samples,
      MutableTagDictionary dict, int cutoff); static final int DEFAULT_BEAM_SIZE; }