use of org.knime.ext.textprocessing.nodes.tagging.TaggedEntity in project knime-cloud by knime.
the class EntityTagger method tagEntities.
@Override
protected List<TaggedEntity> tagEntities(final Sentence sentence) {
final String textValue = sentence.getTextWithWsSuffix();
final DetectEntitiesRequest request = new DetectEntitiesRequest().withText(textValue).withLanguageCode(m_languageCode);
final DetectEntitiesResult result = m_client.detectEntities(request);
return //
result.getEntities().stream().map(//
entity -> new TaggedEntity(entity.getText(), entity.getType())).collect(Collectors.toList());
}
use of org.knime.ext.textprocessing.nodes.tagging.TaggedEntity in project knime-cloud by knime.
the class SyntaxTagger method tagEntities.
@Override
protected List<TaggedEntity> tagEntities(final Sentence sentence) {
final String textValue = sentence.getTextWithWsSuffix();
// Create the delete syntax request
final DetectSyntaxRequest request = new DetectSyntaxRequest().withText(textValue).withLanguageCode(m_languageCode);
final DetectSyntaxResult result = m_client.detectSyntax(request);
return //
result.getSyntaxTokens().stream().map(//
token -> new TaggedEntity(token.getText(), token.getPartOfSpeech().getTag())).collect(Collectors.toList());
}
Aggregations