我已经使用GATE对文档进行了注释,并将输出保存为XML。我需要所有的实体与关系被提取到csv文件,谁能指导我怎么做?
发布于 2018-07-26 19:13:02
您可以通过在流水线中执行此配方来完成此操作
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()},,/)
}}https://stackoverflow.com/questions/49228533
复制相似问题