GATE注释提取

时间:2018-03-12 05:18:07

标签: gate

我使用GATE来注释文档并将输出保存为XML。我需要将所有关系实体提取到csv文件,有人可以指导我怎么做吗?

1 个答案:

答案 0 :(得分:0)

您可以通过在管道中执行此食谱来实现

new File("../outfile.csv").withWriterAppend{ out ->doc.getAnnotations().each {anno ->
  if( anno.getFeatures() )
    anno.getFeatures().each{ fName, fValue ->
      out.writeLine(/"${doc.getName()}","${anno.getType()}","${doc.stringFor(anno)}",${anno.start()},${anno.end()},"${fName}","${fValue}"/)
    }
  else
    out.writeLine(/"${doc.getName()}","${anno.getType()}","${doc.stringFor(anno)}",${anno.start()},${anno.end()},,/)        
}}