• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CoreAnnotation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中edu.stanford.nlp.ling.CoreAnnotation的典型用法代码示例。如果您正苦于以下问题:Java CoreAnnotation类的具体用法?Java CoreAnnotation怎么用?Java CoreAnnotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CoreAnnotation类属于edu.stanford.nlp.ling包,在下文中一共展示了CoreAnnotation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: requirementsSatisfied

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
@Override public Set<Class<? extends CoreAnnotation>> requirementsSatisfied() {
    return new HashSet<>(Arrays.asList(
            CoreAnnotations.TextAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.CharacterOffsetBeginAnnotation.class,
            CoreAnnotations.CharacterOffsetEndAnnotation.class,
            CoreAnnotations.BeforeAnnotation.class,
            CoreAnnotations.AfterAnnotation.class,
            CoreAnnotations.TokenBeginAnnotation.class,
            CoreAnnotations.TokenEndAnnotation.class,
            CoreAnnotations.PositionAnnotation.class,
            CoreAnnotations.IndexAnnotation.class,
            CoreAnnotations.OriginalTextAnnotation.class,
            CoreAnnotations.ValueAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class,
            CoreAnnotations.SentenceIndexAnnotation.class
    ));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:19,代码来源:ItalianTokenizerAnnotator.java


示例2: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Set<Class<? extends CoreAnnotation>> requires() {
    Set<Class<? extends CoreAnnotation>> requirements = new HashSet<>(Arrays.asList(
            CoreAnnotations.TextAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.IndexAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class,
            CoreAnnotations.SentenceIndexAnnotation.class,
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.LemmaAnnotation.class,
            SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class,
            SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation.class,
            SemanticGraphCoreAnnotations.CollapsedCCProcessedDependenciesAnnotation.class,
            CoreAnnotations.OriginalTextAnnotation.class
    ));
    return Collections.unmodifiableSet(requirements);
}
 
开发者ID:intel-analytics,项目名称:InformationExtraction,代码行数:21,代码来源:IntelKBPAnnotator.java


示例3: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
@Override
/**
 * Using the same requirements as the CoreNLP NERCombinerAnnotator
 */
public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
            CoreAnnotations.TextAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class,
            CoreAnnotations.CharacterOffsetBeginAnnotation.class,
            CoreAnnotations.CharacterOffsetEndAnnotation.class,
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.LemmaAnnotation.class,
            CoreAnnotations.BeforeAnnotation.class,
            CoreAnnotations.AfterAnnotation.class,
            CoreAnnotations.TokenBeginAnnotation.class,
            CoreAnnotations.TokenEndAnnotation.class,
            CoreAnnotations.IndexAnnotation.class,
            CoreAnnotations.OriginalTextAnnotation.class,
            CoreAnnotations.SentenceIndexAnnotation.class
        )));
}
 
开发者ID:toliwa,项目名称:CoreNLP-jMWE,代码行数:23,代码来源:JMWEAnnotator.java


示例4: arcLabelsToNode

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Finds all arcs between this node and <code>destNode</code>,
 * and returns the <code>Set</code> of <code>Object</code>s which
 * label those arcs.  If no such arcs exist, returns an empty
 * <code>Set</code>.
 *
 * @param destNode the destination node
 * @return the <code>Set</code> of <code>Object</code>s which
 *         label arcs between this node and <code>destNode</code>
 */
public Set<Class<? extends GrammaticalRelationAnnotation>> arcLabelsToNode(TreeGraphNode destNode) {
  Set<Class<? extends GrammaticalRelationAnnotation>> arcLabels = Generics.newHashSet();
  CyclicCoreLabel cl = label();
  for (Iterator<Class<?>> it = cl.keySet().iterator(); it.hasNext();) {
    Class<? extends CoreAnnotation> key = (Class<? extends CoreAnnotation>) it.next();//javac doesn't compile properly if generics are fully specified (but eclipse does...)
    Object val = cl.get(key);
    if (val != null && val instanceof Set) {
      if (((Set) val).contains(destNode)) {
        if (key != null) {
          arcLabels.add((Class<? extends GrammaticalRelationAnnotation>) key);
        }
      }
    }
  }
  return arcLabels;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:27,代码来源:TreeGraphNode.java


示例5: getAllDependents

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns all the dependencies of a certain node.
 *
 * @param node The node to return dependents for
 * @return map of dependencies
 */
private static Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> getAllDependents(TreeGraphNode node) {
  Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> newMap = Generics.newHashMap();

  for (Class<?> o : node.label.keySet()) {
    try {
      // The line below will exception unless it's a GrammaticalRelationAnnotation,
      // so the effect is that only the GrammaticalRelationAnnotation things get put into newMap
      o.asSubclass(GrammaticalRelationAnnotation.class);
      newMap.put((Class<? extends CoreAnnotation>) o, (Set<TreeGraphNode>) node.label.get((Class<? extends CoreAnnotation>) o));//javac doesn't compile properly if generics are fully specified (but eclipse does...)
    } catch (Exception e) {
      // ignore a non-GrammaticalRelationAnnotation element
    }
  }
  return newMap;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:22,代码来源:GrammaticalStructure.java


示例6: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override
public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.PartOfSpeechAnnotation.class,
            DigiMorphAnnotations.MorphoAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:15,代码来源:DigiLemmaAnnotator.java


示例7: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.LemmaAnnotation.class,
            DigiMorphAnnotations.MorphoAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:12,代码来源:DigiCompMorphAnnotator.java


示例8: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:12,代码来源:DigiMorphAnnotator.java


示例9: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.LemmaAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:14,代码来源:VerbAnnotator.java


示例10: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.LemmaAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:14,代码来源:ReadabilityAnnotator.java


示例11: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
@Override
public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.TokensAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:8,代码来源:UPosAnnotator.java


示例12: requirementsSatisfied

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Set<Class<? extends CoreAnnotation>> requirementsSatisfied() {
    Set<Class<? extends CoreAnnotation>> requirements = new HashSet<>(Arrays.asList(
            CoreAnnotations.MentionsAnnotation.class,
            CoreAnnotations.KBPTriplesAnnotation.class
    ));
    return Collections.unmodifiableSet(requirements);
}
 
开发者ID:intel-analytics,项目名称:InformationExtraction,代码行数:12,代码来源:IntelKBPAnnotator.java


示例13: getDep

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/** Look through the tree t and adds to the List basicDep dependencies
 *  which aren't in it but which satisfy the filter f.
 *
 * @param t The tree to examine (not changed)
 * @param basicDep The list of dependencies which may be augmented
 * @param f Additional dependencies are added only if they pass this filter
 */
private static void getDep(TreeGraphNode t, List<TypedDependency> basicDep,
                           Filter<TypedDependency> f) {
  if (t.numChildren() > 0) {          // don't do leaves
    Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> depMap = getAllDependents(t);
    for (Class<? extends CoreAnnotation> depName : depMap.keySet()) {
      for (TreeGraphNode depNode : depMap.get(depName)) {
        TreeGraphNode gov = t.headWordNode();
        TreeGraphNode dep = depNode.headWordNode();
        if (gov != dep) {
          List<GrammaticalRelation> rels = getListGrammaticalRelation(t, depNode);
          if (!rels.isEmpty()) {
            for (GrammaticalRelation rel : rels) {
              TypedDependency newDep = new TypedDependency(rel, gov, dep);
              if (!basicDep.contains(newDep) && f.accept(newDep)) {
                newDep.setExtra();
                basicDep.add(newDep);
              }
            }
          }
        }
      }
    }
    // now recurse into children
    for (Tree kid : t.children()) {
      getDep((TreeGraphNode) kid, basicDep, f);
    }
  }
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:36,代码来源:GrammaticalStructure.java


示例14: classifyKBest

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
public Counter<List<IN>> classifyKBest(List<IN> doc, Class<? extends CoreAnnotation<String>> answerField, int k) {

    if (doc.isEmpty()) {
      return new ClassicCounter<List<IN>>();
    }

    // TODO get rid of ObjectBankWrapper
    // i'm sorry that this is so hideous - JRF
    ObjectBankWrapper<IN> obw = new ObjectBankWrapper<IN>(flags, null, knownLCWords);
    doc = obw.processDocument(doc);

    SequenceModel model = getSequenceModel(doc);

    KBestSequenceFinder tagInference = new KBestSequenceFinder();
    Counter<int[]> bestSequences = tagInference.kBestSequences(model, k);

    Counter<List<IN>> kBest = new ClassicCounter<List<IN>>();

    for (int[] seq : bestSequences.keySet()) {
      List<IN> kth = new ArrayList<IN>();
      int pos = model.leftWindow();
      for (IN fi : doc) {
        IN newFL = tokenFactory.makeToken(fi);
        String guess = classIndex.get(seq[pos]);
        fi.remove(CoreAnnotations.AnswerAnnotation.class); // because fake answers will get
                                           // added during testing
        newFL.set(answerField, guess);
        pos++;
        kth.add(newFL);
      }
      kBest.setCount(kth, bestSequences.getCount(seq));
    }

    return kBest;
  }
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:36,代码来源:AbstractSequenceClassifier.java


示例15: getViterbiSearchGraph

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
public DFSA<String, Integer> getViterbiSearchGraph(List<IN> doc, Class<? extends CoreAnnotation<String>> answerField) {
  if (doc.isEmpty()) {
    return new DFSA<String, Integer>(null);
  }
  // TODO get rid of objectbankwrapper
  ObjectBankWrapper<IN> obw = new ObjectBankWrapper<IN>(flags, null, knownLCWords);
  doc = obw.processDocument(doc);
  SequenceModel model = getSequenceModel(doc);
  return ViterbiSearchGraphBuilder.getGraph(model, classIndex);
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:11,代码来源:AbstractSequenceClassifier.java


示例16: addLemma

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
private static void addLemma(Morphology morpha,
                      Class<? extends CoreAnnotation<String>> ann,
                      CoreMap map, String word, String tag) {
  if (tag.length() > 0) {
    String phrasalVerb = phrasalVerb(morpha, word, tag);
    if (phrasalVerb == null) {
      map.set(ann, morpha.lemma(word, tag));
    } else {
      map.set(ann, phrasalVerb);
    }
  } else {
    map.set(ann, morpha.stem(word));
  }
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:15,代码来源:MorphaAnnotator.java


示例17: getDep

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/** Look through the tree t and adds to the List basicDep dependencies
 *  which aren't in it but which satisfy the filter f.
 *
 * @param t The tree to examine (not changed)
 * @param basicDep The list of dependencies which may be augmented
 * @param f Additional dependencies are added only if they pass this filter
 */
private static void getDep(TreeGraphNode t, List<TypedDependency> basicDep,
                           Filter<TypedDependency> f) {
  if (t.isPhrasal()) {          // don't do leaves of POS tags (chris changed this from numChildren > 0 in 2010)
    Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> depMap = getAllDependents(t);
    for (Class<? extends CoreAnnotation> depName : depMap.keySet()) {
      for (TreeGraphNode depNode : depMap.get(depName)) {
        TreeGraphNode gov = t.headWordNode();
        TreeGraphNode dep = depNode.headWordNode();
        if (gov != dep) {
          List<GrammaticalRelation> rels = getListGrammaticalRelation(t, depNode);
          if (!rels.isEmpty()) {
            for (GrammaticalRelation rel : rels) {
              TypedDependency newDep = new TypedDependency(rel, gov, dep);
              if (!basicDep.contains(newDep) && f.accept(newDep)) {
                newDep.setExtra();
                basicDep.add(newDep);
              }
            }
          }
        }
      }
    }
    // now recurse into children
    for (Tree kid : t.children()) {
      getDep((TreeGraphNode) kid, basicDep, f);
    }
  }
}
 
开发者ID:amark-india,项目名称:eventspotter,代码行数:36,代码来源:GrammaticalStructure.java


示例18: getAllDependents

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns all the dependencies of a certain node.
 *
 * @param node The node to return dependents for
 * @return map of dependencies
 */
private static Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> getAllDependents(TreeGraphNode node) {
  Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> newMap = Generics.newHashMap();

  for (Class<?> o : node.label.keySet()) {
    if (GrammaticalRelationAnnotation.class.isAssignableFrom(o)) {
      // ignore a non-GrammaticalRelationAnnotation element
      newMap.put((Class<? extends CoreAnnotation>) o, (Set<TreeGraphNode>) node.label.get((Class<? extends CoreAnnotation>) o));//javac doesn't compile properly if generics are fully specified (but eclipse does...)
    }
  }
  return newMap;
}
 
开发者ID:amark-india,项目名称:eventspotter,代码行数:18,代码来源:GrammaticalStructure.java


示例19: requirementsSatisfied

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns a set of requirements for which tasks this annotator can
 * provide.  For example, the POS annotator will return "pos".
 */
@Override
public Set<Class<? extends CoreAnnotation>> requirementsSatisfied() {
    return Collections.singleton(CoreAnnotations.LemmaAnnotation.class);
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:9,代码来源:DigiLemmaAnnotator.java


示例20: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.emptySet();
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:4,代码来源:ItalianTokenizerAnnotator.java



注:本文中的edu.stanford.nlp.ling.CoreAnnotation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java KeyspaceMetadata类代码示例发布时间:2022-05-21
下一篇:
Java Callback类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap