Parse GATE Document to get Co-Reference Text

狂风中的少年 提交于 2019-12-04 15:30:24

I do not know about yours, but co-references created manually using the Co-reference Editor are stored in a document feature. The feature name seems to be "MatchesAnnots" and the type Map<String, List<List<Integer>>>.

In my case, following code prints as name: null (the default annotation set) followed by all co-reference chains present in it.

Object obj = document.getFeatures().get("MatchesAnnots");

@SuppressWarnings("unchecked")
Map<String, List<List<Integer>>> map = (Map<String, List<List<Integer>>>) obj;

for (Entry<String, List<List<Integer>>> e : map.entrySet()) {
    System.err.println("as name: "+  e.getKey());
    for (List<Integer> chain : e.getValue()) {
        System.err.println("chain : "+  chain);         
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!