当前位置: 首页>>代码示例>>Java>>正文


Java Interner类代码示例

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


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

示例1: getRelation

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
/**
 * Static factory method for relations requiring an argument, including
 * HAS_ITH_CHILD, ITH_CHILD_OF, UNBROKEN_CATEGORY_DOMINATES,
 * UNBROKEN_CATEGORY_DOMINATED_BY.
 *
 * @param s The String representation of the relation
 * @param arg The argument to the relation, as a string; could be a node
 *          description or an integer
 * @return The singleton static relation of the specified type with the
 *         specified argument. Uses Interner to insure singleton-ity
 * @throws ParseException If bad relation s
 */
static Relation getRelation(String s, String arg) throws ParseException {
  if (arg == null) {
    return getRelation(s);
  }
  Relation r;
  if (s.equals("<")) {
    r = new HasIthChild(Integer.parseInt(arg));
  } else if (s.equals(">")) {
    r = new IthChildOf(Integer.parseInt(arg));
  } else if (s.equals("<+")) {
    r = new UnbrokenCategoryDominates(arg);
  } else if (s.equals(">+")) {
    r = new UnbrokenCategoryIsDominatedBy(arg);
  } else if (s.equals(".+")) {
    r = new UnbrokenCategoryPrecedes(arg);
  } else if (s.equals(",+")) {
    r = new UnbrokenCategoryFollows(arg);
  } else {
    throw new ParseException("Unrecognized compound relation " + s + ' '
        + arg);
  }
  return Interner.globalIntern(r);
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:36,代码来源:Relation.java

示例2: setGlobal

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
/**
 * For supplying a new instance for the global methods to use.
 *
 * @return the previous global interner.
 */
public static SynchronizedInterner<Object> setGlobal(Interner<Object> delegate) {
  synchronized(globalMutex) {
    SynchronizedInterner<Object> oldInterner = SynchronizedInterner.interner;
    SynchronizedInterner.interner = Generics.newSynchronizedInterner(delegate);
    return oldInterner;
  }
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:13,代码来源:SynchronizedInterner.java

示例3: readObject

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
private void readObject(ObjectInputStream ois)
  throws IOException, ClassNotFoundException
{
  ois.defaultReadObject();
  // reinitialize the transient objects
  itwInterner = new Interner<IntTaggedWord>();
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:8,代码来源:AbstractDependencyGrammar.java

示例4: getRelation

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
/**
 * Static factory method for all relations with no arguments. Includes:
 * DOMINATES, DOMINATED_BY, PARENT_OF, CHILD_OF, PRECEDES,
 * IMMEDIATELY_PRECEDES, HAS_LEFTMOST_DESCENDANT, HAS_RIGHTMOST_DESCENDANT,
 * LEFTMOST_DESCENDANT_OF, RIGHTMOST_DESCENDANT_OF, SISTER_OF, LEFT_SISTER_OF,
 * RIGHT_SISTER_OF, IMMEDIATE_LEFT_SISTER_OF, IMMEDIATE_RIGHT_SISTER_OF,
 * HEADS, HEADED_BY, IMMEDIATELY_HEADS, IMMEDIATELY_HEADED_BY, ONLY_CHILD_OF,
 * HAS_ONLY_CHILD, EQUALS
 *
 * @param s The String representation of the relation
 * @return The singleton static relation of the specified type
 * @throws ParseException If bad relation s
 */
static Relation getRelation(String s,
                            Function<String, String> basicCatFunction,
                            HeadFinder headFinder)
  throws ParseException
{
  if (SIMPLE_RELATIONS_MAP.containsKey(s))
    return SIMPLE_RELATIONS_MAP.get(s);

  // these are shorthands for relations with arguments
  if (s.equals("<,")) {
    return getRelation("<", "1", basicCatFunction, headFinder);
  } else if (parentOfLastChild.matcher(s).matches()) {
    return getRelation("<", "-1", basicCatFunction, headFinder);
  } else if (s.equals(">,")) {
    return getRelation(">", "1", basicCatFunction, headFinder);
  } else if (lastChildOfParent.matcher(s).matches()) {
    return getRelation(">", "-1", basicCatFunction, headFinder);
  }

  // finally try relations with headFinders
  Relation r;
  if (s.equals(">>#")) {
    r = new Heads(headFinder);
  } else if (s.equals("<<#")) {
    r = new HeadedBy(headFinder);
  } else if (s.equals(">#")) {
    r = new ImmediatelyHeads(headFinder);
  } else if (s.equals("<#")) {
    r = new ImmediatelyHeadedBy(headFinder);
  } else {
    throw new ParseException("Unrecognized simple relation " + s);
  }

  return Interner.globalIntern(r);
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:49,代码来源:Relation.java

示例5: HeadedBy

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
HeadedBy(HeadFinder hf) {
  super("<<#");
  this.heads = Interner.globalIntern(new Heads(hf));
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:5,代码来源:Relation.java

示例6: ImmediatelyHeadedBy

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
ImmediatelyHeadedBy(HeadFinder hf) {
  super("<#");
  this.immediatelyHeads = Interner
      .globalIntern(new ImmediatelyHeads(hf));
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:6,代码来源:Relation.java

示例7: HasIthChild

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
HasIthChild(int i) {
  super('<' + String.valueOf(i));
  ithChildOf = Interner.globalIntern(new IthChildOf(i));
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:5,代码来源:Relation.java

示例8: UnbrokenCategoryIsDominatedBy

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
UnbrokenCategoryIsDominatedBy(String arg) {
  super(">+(" + arg + ')');
  unbrokenCategoryDominates = Interner
      .globalIntern((new UnbrokenCategoryDominates(arg)));
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:6,代码来源:Relation.java

示例9: SynchronizedInterner

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
public SynchronizedInterner(Interner<T> delegate) {
  if (delegate == null) throw new NullPointerException();
  this.delegate = delegate;
  this.mutex = this;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:6,代码来源:SynchronizedInterner.java

示例10: UnbrokenCategoryIsDominatedBy

import edu.stanford.nlp.util.Interner; //导入依赖的package包/类
UnbrokenCategoryIsDominatedBy(String arg,
                              Function<String, String> basicCatFunction) {
  super(">+(" + arg + ')');
  unbrokenCategoryDominates = Interner
    .globalIntern((new UnbrokenCategoryDominates(arg, basicCatFunction)));
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:7,代码来源:Relation.java


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