문제

I can get a string annotated with Named Entities with the following code.

String NEString =  classifier.classifyWithInlineXML(fileContents)

I'm wondering if there is any method to call so that I can get separate entities (PERSON, ORGANIZATION, LOCATIOIN) lists in the file, that way I don't have to parse the retrieved string with the above method to get the entity lists?

도움이 되었습니까?

해결책

In my opinion, the cleanes way to run the classification is:

List<Triple<String,Integer,Integer>> out = classifier.classifyToCharacterOffsets(text);
triple.first(): entity type
triple.second(): start position
triple.third(): end position

It groups consequent entities and returns the start and end position of entities.

다른 팁

As I know there are 3 ways to get annotated string:

1) classifier.classifyToString(" ")

2) classifier.classifyWithInlineXML(" ")

3) classifier.classifyToString(" ", "xml", true)

The first one is the easiest to seperate. Unfortunately, there isn't any method as you wish.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top