cc.mallet.types.InstanceList.add()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(135)

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

InstanceList.add介绍

[英]Appends the instance to this list without passing the instance through the InstanceList's pipe. The alphabets of this Instance must match the alphabets of this InstanceList.
[中]将实例追加到此列表,而不通过InstanceList的管道传递实例。此实例的字母表必须与此实例列表的字母表匹配。

代码示例

代码示例来源:origin: cc.mallet/mallet

public boolean addAll (Collection<? extends Instance> instances) {
  for (Instance instance : instances)
    this.add (instance);
  return true;
}

代码示例来源:origin: com.github.steveash.mallet/mallet

public boolean addAll (Collection<? extends Instance> instances) {
  for (Instance instance : instances)
    this.add (instance);
  return true;
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public boolean addAll (Collection<? extends Instance> instances) {
  for (Instance instance : instances)
    this.add (instance);
  return true;
}

代码示例来源:origin: cc.mallet/mallet

/** Constructs and appends an instance to this list, passing it through this
 * list's pipe.  Default weight is 1.0.
 * @return <code>true</code>
 * @deprecated Use trainingset.add (new Instance(data,target,name,source)) instead.
 */
@Deprecated
public boolean add (Object data, Object target, Object name, Object source)
{
  return add (data, target, name, source, 1.0);
}

代码示例来源:origin: cc.mallet/mallet

public InstanceList subList (int start, int end)
{
  InstanceList other = this.cloneEmpty();
  for (int i = start; i < end; i++) {
    other.add (get (i));
  }
  return other;
}

代码示例来源:origin: com.github.steveash.mallet/mallet

public InstanceList subList (int start, int end)
{
  InstanceList other = this.cloneEmpty();
  for (int i = start; i < end; i++) {
    other.add (get (i));
  }
  return other;
}

代码示例来源:origin: cc.mallet/mallet

public InstanceList sampleWithReplacement (java.util.Random r, int numSamples)
{
  InstanceList ret = this.cloneEmpty();
  for (int i = 0; i < numSamples; i++)
    ret.add (this.get(r.nextInt(this.size())));
  return ret;
}

代码示例来源:origin: cc.mallet/mallet

public InstanceList subList (double proportion)
{
  if (proportion > 1.0)
    throw new IllegalArgumentException ("proportion must by <= 1.0");
  InstanceList other = (InstanceList) clone();
  other.shuffle(new java.util.Random());
  proportion *= other.size();
  for (int i = 0; i < proportion; i++)
    other.add (get(i));
  return other;
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

/**
 *
 * @param i
 * @param j
 * @return A new {@link InstanceList} containing the two argument {@link Instance}s.
 */
public static InstanceList makeList (Instance i, Instance j) {
  InstanceList list = new InstanceList(new Noop(i.getDataAlphabet(), i.getTargetAlphabet()));
  list.add(i);
  list.add(j);
  return list;
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public InstanceList subList (double proportion)
{
  if (proportion > 1.0)
    throw new IllegalArgumentException ("proportion must by <= 1.0");
  InstanceList other = (InstanceList) clone();
  other.shuffle(new java.util.Random());
  proportion *= other.size();
  for (int i = 0; i < proportion; i++)
    other.add (get(i));
  return other;
}

代码示例来源:origin: cc.mallet/mallet

/**
 *
 * @param i
 * @param j
 * @return A new {@link InstanceList} containing the two argument {@link Instance}s.
 */
public static InstanceList makeList (Instance i, Instance j) {
  InstanceList list = new InstanceList(new Noop(i.getDataAlphabet(), i.getTargetAlphabet()));
  list.add(i);
  list.add(j);
  return list;
}

代码示例来源:origin: com.github.steveash.mallet/mallet

/**
 *
 * @param i
 * @param j
 * @return A new {@link InstanceList} containing the two argument {@link Instance}s.
 */
public static InstanceList makeList (Instance i, Instance j) {
  InstanceList list = new InstanceList(new Noop(i.getDataAlphabet(), i.getTargetAlphabet()));
  list.add(i);
  list.add(j);
  return list;
}

代码示例来源:origin: cc.mallet/mallet

public InstanceList getInstances() 
{ 
  InstanceList ret = new InstanceList(m_ilist.getPipe());
  for (int ii = 0; ii < m_instIndices.length; ii++)
    ret.add(m_ilist.get(m_instIndices[ii]));
  return ret; 
}

代码示例来源:origin: cc.mallet/mallet

public InstanceList shallowClone () {
  InstanceList ret = this.cloneEmpty ();
  for (int i = 0; i < this.size (); i++) {
    ret.add (get (i));
  }
  return ret;
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public InstanceList shallowClone () {
  InstanceList ret = this.cloneEmpty ();
  for (int i = 0; i < this.size (); i++) {
    ret.add (get (i));
  }
  return ret;
}

代码示例来源:origin: cc.mallet/mallet

public Sequence pipeInput (Object input)
 {
  InstanceList all = new InstanceList (getFeaturePipe ());
  all.add (input, null, null, null);
  return (Sequence) all.get (0).getData();
 }
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public Sequence pipeInput (Object input)
 {
  InstanceList all = new InstanceList (getFeaturePipe ());
  all.add (input, null, null, null);
  return (Sequence) all.get (0).getData();
 }
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

/** Return an list of instances with a particular label. */
public InstanceList getCluster(int label) {		
  InstanceList cluster = new InstanceList(instances.getPipe());		
  for (int n=0 ; n<instances.size() ; n++) 
  if (labels[n] == label)
      cluster.add(instances.get(n));			
  return cluster;
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

/**
   Iterates over {@link Segment}s for only one {@link Instance}.
 */
public SegmentIterator (Transducer model, Instance instance, Object[] segmentStartTags,
                        Object[] segmentContinueTags) {
  InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet()));
  ilist.add (instance);
  setSubIterator (model, ilist, segmentStartTags, segmentContinueTags);
}

代码示例来源:origin: com.github.steveash.mallet/mallet

/**
   Iterates over {@link Segment}s for only one {@link Instance}.
 */
public SegmentIterator (Transducer model, Instance instance, Object[] segmentStartTags,
                        Object[] segmentContinueTags) {
  InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet()));
  ilist.add (instance);
  setSubIterator (model, ilist, segmentStartTags, segmentContinueTags);
}

相关文章

微信公众号

最新文章

更多