@Override
public void startElement(String u, String l, String qName, Attributes attributes) throws SAXException {
if (qName.equals("GGS:SpanAnnotation") || qName.equals("GGS:Annotation")) {
Document doc = new Document();
for (int i = 0; i < attributes.getLength(); i++) {
doc.add(new StringField(attributes.getLocalName(i), attributes.getValue(i), Field.Store.YES));
}
try {
annotationsWriter.addDocument(doc);
} catch (IOException e) {
e.printStackTrace();
}
return;
}
if (qName.equals(sent) || nodesStack.size() > 0) {
nodesStack.push(qName);
segmentStartsStack.push(totalWords);
if (attributes != null && attributes.getLength() > 0) {
attributesStack.push(new AttributesImpl(attributes));
} else {
attributesStack.push(new AttributesImpl());
}
sb = new StringBuilder();
}
}
IndexedLuceneCorpus.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:UaicNlpToolkit
作者:
评论列表
文章目录