热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

edu.stanford.nlp.ling.IndexedWord.docID()方法的使用及代码示例

本文整理了Java中edu.stanford.nlp.ling.IndexedWord.docID()方法的一些代码示例,展示了IndexedWord.do

本文整理了Java中edu.stanford.nlp.ling.IndexedWord.docID()方法的一些代码示例,展示了IndexedWord.docID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndexedWord.docID()方法的具体详情如下:
包路径:edu.stanford.nlp.ling.IndexedWord
类名称:IndexedWord
方法名:docID

IndexedWord.docID介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

private Pair getGovAndReln(double govPseudoIndex,
IndexedWord word,
String relationName,
List sortedTokens) {
IndexedWord gov;
GrammaticalRelation reln;
if (relationName.equals("root")) {
reln = GrammaticalRelation.ROOT;
} else {
reln = GrammaticalRelation.valueOf(this.lang, relationName);
}
if (govPseudoIndex == 0.0) {
gov = new IndexedWord(word.docID(), word.sentIndex(), 0);
gov.setValue("ROOT");
} else {
gov = this.getToken(sortedTokens, govPseudoIndex);
}
return Generics.newPair(gov, reln);
}

代码示例来源:origin: stanfordnlp/CoreNLP

/** Returns a list of TypedDependency in the graph.
* This method goes through all SemanticGraphEdge and converts them
* to TypedDependency.
*
* @return A List of TypedDependency in the graph
*/
public Collection typedDependencies() {
Collection dependencies = new ArrayList<>();
IndexedWord root = null;
for (IndexedWord node : roots) {
if (root == null) {
root = new IndexedWord(node.docID(), node.sentIndex(), 0);
root.setValue("ROOT");
}
TypedDependency dependency = new TypedDependency(ROOT, root, node);
dependencies.add(dependency);
}
for (SemanticGraphEdge e : this.edgeIterable()){
TypedDependency dependency = new TypedDependency(e.getRelation(), e.getGovernor(), e.getDependent());
if (e.isExtra()) {
dependency.setExtra();
}
dependencies.add(dependency);
}
return dependencies;
}

代码示例来源:origin: stanfordnlp/CoreNLP

Collections.sort(sortedSubgraphNodes);
IndexedWord newNode = new IndexedWord(rootNode.docID(), rootNode.sentIndex(), rootNode.index());

代码示例来源:origin: stanfordnlp/CoreNLP

/**
* TODO: figure out how to specify where in the sentence this node goes.
* TODO: determine if we should be copying an IndexedWord, or working just with a FeatureLabel.
* TODO: bombproof if this gov, dep, and reln already exist.
*/
@Override
public void evaluate(SemanticGraph sg, SemgrexMatcher sm) {
IndexedWord govNode = sm.getNode(govNodeName);
IndexedWord newNode = new IndexedWord(newNodePrototype);
int newIndex = SemanticGraphUtils.leftMostChildVertice(govNode, sg).index(); // cheap En-specific hack for placing copula (beginning of governing phrase)
newNode.setDocID(govNode.docID());
newNode.setIndex(newIndex);
newNode.setSentIndex(govNode.sentIndex());
sg.addVertex(newNode);
sg.addEdge(govNode, newNode, relation, weight,false);
}

代码示例来源:origin: stanfordnlp/CoreNLP

if (word.docID() == null && docid != null) {
word.setDocID(docid);

代码示例来源:origin: stanfordnlp/CoreNLP

if (word.docID() == null && in.docId != null) {
word.setDocID(in.docId);

代码示例来源:origin: edu.stanford.nlp/stanford-parser

private static Pair getGovAndReln(int govIdx,
int copyCount,
IndexedWord word, String relationName,
List sortedTokens) {
IndexedWord gov;
GrammaticalRelation reln;
if (relationName.equals("root")) {
reln = GrammaticalRelation.ROOT;
} else {
reln = GrammaticalRelation.valueOf(Language.UniversalEnglish, relationName);
}
if (govIdx == 0) {
gov = new IndexedWord(word.docID(), word.sentIndex(), 0);
gov.setValue("ROOT");
} else {
gov = SentenceProcessor.getToken(sortedTokens, govIdx, copyCount);
}
return Generics.newPair(gov, reln);
}

代码示例来源:origin: eu.fbk.fcw/fcw-udpipe-api

IndexedWord gov;
if (govIdx == 0) {
gov = new IndexedWord(word.docID(), word.sentIndex(), 0);
gov.setValue("ROOT");
if (word.get(CoreAnnotations.CoNLLDepTypeAnnotation.class).equals("root")) {

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

private static Pair getGovAndReln(int govIdx,
int copyCount,
IndexedWord word, String relationName,
List sortedTokens) {
IndexedWord gov;
GrammaticalRelation reln;
if (relationName.equals("root")) {
reln = GrammaticalRelation.ROOT;
} else {
reln = GrammaticalRelation.valueOf(Language.UniversalEnglish, relationName);
}
if (govIdx == 0) {
gov = new IndexedWord(word.docID(), word.sentIndex(), 0);
gov.setValue("ROOT");
} else {
gov = SentenceProcessor.getToken(sortedTokens, govIdx, copyCount);
}
return Generics.newPair(gov, reln);
}

代码示例来源:origin: edu.stanford.nlp/stanford-parser

/** Returns a list of TypedDependency in the graph.
* This method goes through all SemanticGraphEdge and converts them
* to TypedDependency.
*
* @return A List of TypedDependency in the graph
*/
public Collection typedDependencies() {
Collection dependencies = new ArrayList<>();
IndexedWord root = null;
for (IndexedWord node : roots) {
if (root == null) {
root = new IndexedWord(node.docID(), node.sentIndex(), 0);
root.setValue("ROOT");
}
TypedDependency dependency = new TypedDependency(ROOT, root, node);
dependencies.add(dependency);
}
for (SemanticGraphEdge e : this.edgeIterable()){
TypedDependency dependency = new TypedDependency(e.getRelation(), e.getGovernor(), e.getDependent());
if (e.isExtra()) {
dependency.setExtra();
}
dependencies.add(dependency);
}
return dependencies;
}

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

/** Returns a list of TypedDependency in the graph.
* This method goes through all SemanticGraphEdge and converts them
* to TypedDependency.
*
* @return A List of TypedDependency in the graph
*/
public Collection typedDependencies() {
Collection dependencies = new ArrayList<>();
IndexedWord root = null;
for (IndexedWord node : roots) {
if (root == null) {
root = new IndexedWord(node.docID(), node.sentIndex(), 0);
root.setValue("ROOT");
}
TypedDependency dependency = new TypedDependency(ROOT, root, node);
dependencies.add(dependency);
}
for (SemanticGraphEdge e : this.edgeIterable()){
TypedDependency dependency = new TypedDependency(e.getRelation(), e.getGovernor(), e.getDependent());
if (e.isExtra()) {
dependency.setExtra();
}
dependencies.add(dependency);
}
return dependencies;
}

代码示例来源:origin: com.guokr/stan-cn-com

/** Returns a list of TypedDependency in the graph.
* This method goes through all SemanticGraphEdge and converts them
* to TypedDependency.
*
* @return A List of TypedDependency in the graph
*/
public Collection typedDependencies() {
Collection dependencies = new ArrayList();
// FIXME: parts of the code (such as the dependencies) expect the
// TreeGraphNodes to be == equal, but that doesn't apply the way
// this method is written
TreeGraphNode root = null;
for (IndexedWord node : roots) {
if (root == null) {
IndexedWord rootLabel = new IndexedWord(node.docID(), node.sentIndex(), 0);
rootLabel.setValue("ROOT");
root = new TreeGraphNode(rootLabel);
}
TypedDependency dependency = new TypedDependency(ROOT, root, new TreeGraphNode(node));
dependencies.add(dependency);
}
for (SemanticGraphEdge e : this.edgeIterable()){
TreeGraphNode gov = new TreeGraphNode(e.getGovernor());
TreeGraphNode dep = new TreeGraphNode(e.getDependent());
TypedDependency dependency = new TypedDependency(e.getRelation(), gov, dep);
dependencies.add(dependency);
}
return dependencies;
}

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

if (word.docID() == null && docid != null) {
word.setDocID(docid);

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

if (word.docID() == null && in.docId != null) {
word.setDocID(in.docId);

推荐阅读
author-avatar
CQ莹儿_259
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有