IndexedLuceneCorpus.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:UaicNlpToolkit 作者:
@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();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号