...
var request = new SpacyEntRequest(
"en_core_web_md", // the model to use
"the text to analyze",
0, // 1 if we should collapse punctuation, 0 otherwise
0 // 1 if we should collapse phrases, 0 otherwise
);
var response = client.getEntities(request);
// Check the return code
if (!response.isSuccessful()) {
// handle error
}
response.forEachRemaining(entity -> {
// Do something with the enitites
entity.getStart();
entity.getEnd();
entity.getText();
entity.getType();
})
...
var request = new SpacyDepRequest(
"en_core_web_md", // the model to use
"the text to analyze",
0false, // 1true if we should collapse punctuation, 0false otherwise
0false // 1true if we should collapse phrases, 0false otherwise
);
var response = client.getDependencies(request);
// Check the return code
if (!response.isSuccessful()) {
// handle error
}
response.getArcs().forEach(arc -> {
// Do something with the arcs
arc.getStart();
arc.getEnd();
arc.getDir();
arc.getLabel();
arc.getText();
});
response.getWords().forEach(word -> {
// Do something with the arcs
word.getTag();
word.getText();
});