@Test public void testTagPOS() { List<String> tags = new ArrayList<>(); for (PosToken token : lexLib.tagPOS(sentenceFragments.get(0))) { tags.add(token.getPos()); } assertEquals("POS should match.", newArrayList("DT", "VBZ", "DT", "JJ", "NN", "."), tags); }
@Override public List<PosToken> tagPOS(String sentence) { String[] tokens = tokenizer.tokenize(sentence); Span[] spans = tokenizer.tokenizePos(sentence); String[] tags = tagger.tag(tokens); List<PosToken> poss = new ArrayList<>(); for (int i = 0; i < tokens.length; i++) { poss.add(new PosToken(tokens[i], tags[i], spans[i].getStart(), spans[i].getEnd())); } return poss; }
LexicalLibOpenNlpImpl implements LexicalLib { @Override public List<PosToken> tagPOS(String sentence) { String[] tokens = tokenizer.tokenize(sentence); Span[] spans = tokenizer.tokenizePos(sentence); String[] tags = tagger.tag(tokens); List<PosToken> poss = new ArrayList<>(); for (int i = 0; i < tokens.length; i++) { poss.add(new PosToken(tokens[i], tags[i], spans[i].getStart(), spans[i].getEnd())); } return poss; } }
LexicalLibOpenNlpImpl implements LexicalLib { @Override public List<PosToken> tagPOS(String sentence) { String[] tokens = tokenizer.tokenize(sentence); Span[] spans = tokenizer.tokenizePos(sentence); String[] tags = tagger.tag(tokens); List<PosToken> poss = new ArrayList<>(); for (int i = 0; i < tokens.length; i++) { poss.add(new PosToken(tokens[i], tags[i], spans[i].getStart(), spans[i].getEnd())); } return poss; } @Inject protected  LexicalLibOpenNlpImpl(
      TokenizerProvider tokenizerProvider,
      SentenceDetectorProvider sentenceProvider,
      PosTaggerProvider posProvider,
      ChunkerProvider chunkerProvider); }
LexicalLibOpenNlpImpl implements LexicalLib { @Override public List<PosToken> tagPOS(String sentence) { String[] tokens = tokenizer.tokenize(sentence); Span[] spans = tokenizer.tokenizePos(sentence); String[] tags = tagger.tag(tokens); List<PosToken> poss = new ArrayList<>(); for (int i = 0; i < tokens.length; i++) { poss.add(new PosToken(tokens[i], tags[i], spans[i].getStart(), spans[i].getEnd())); } return poss; } @Inject protected  LexicalLibOpenNlpImpl(
      TokenizerProvider tokenizerProvider,
      SentenceDetectorProvider sentenceProvider,
      PosTaggerProvider posProvider,
      ChunkerProvider chunkerProvider); @Override List<String> extractSentences(String text); @Override List<PosToken> tagPOS(String sentence); @Override List<Token<String>> getChunks(String text); @Override @Beta List<Token<String>> getEntities(String text); }
LexicalLibOpenNlpImpl implements LexicalLib { @Override public List<PosToken> tagPOS(String sentence) { String[] tokens = tokenizer.tokenize(sentence); Span[] spans = tokenizer.tokenizePos(sentence); String[] tags = tagger.tag(tokens); List<PosToken> poss = new ArrayList<>(); for (int i = 0; i < tokens.length; i++) { poss.add(new PosToken(tokens[i], tags[i], spans[i].getStart(), spans[i].getEnd())); } return poss; } @Inject protected  LexicalLibOpenNlpImpl(
      TokenizerProvider tokenizerProvider,
      SentenceDetectorProvider sentenceProvider,
      PosTaggerProvider posProvider,
      ChunkerProvider chunkerProvider); @Override List<String> extractSentences(String text); @Override List<PosToken> tagPOS(String sentence); @Override List<Token<String>> getChunks(String text); @Override @Beta List<Token<String>> getEntities(String text);  }