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

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

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

Instance.setTarget介绍

暂无

代码示例

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

/** Sets the "target" field to <code>null</code> in all instances.  This makes unlabeled data. */
public void removeTargets()
{
  for (Instance instance : this)
    instance.setTarget (null);
}

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

/** Sets the "target" field to <code>null</code> in all instances.  This makes unlabeled data. */
public void removeTargets()
{
  for (Instance instance : this)
    instance.setTarget (null);
}

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

public Instance pipe (Instance carrier) {
  if (carrier.getTarget() != null) {
    if (! (carrier.getTarget() instanceof String)) {
      throw new IllegalArgumentException ("Target must be a string for conversion to Double");
    }
    carrier.setTarget( new Double((String) carrier.getTarget()) );
  }
  return carrier;
}

代码示例来源:origin: dstl/baleen

@Override
 public Instance pipe(Instance carrier) {
  carrier.setTarget(new NullLabel((LabelAlphabet) getTargetAlphabet()));
  return carrier;
 }
}

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

public Instance pipe (Instance carrier)
 {
  LabelsSequence lbls = (LabelsSequence) carrier.getTarget ();
  carrier.setTarget (new LabelsAssignment (lbls));
  return carrier;
 }
}

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

public Instance pipe (Instance carrier)
 {
  LabelsSequence lbls = (LabelsSequence) carrier.getTarget ();
  carrier.setTarget (new LabelsAssignment (lbls));
  return carrier;
 }
}

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

public Instance pipe (Instance carrier) {
  if (carrier.getTarget() != null) {
    if (! (carrier.getTarget() instanceof String)) {
      throw new IllegalArgumentException ("Target must be a String for conversion to Integer");
    }
    carrier.setTarget( new Integer((String) carrier.getTarget()) );
  }
  return carrier;
}

代码示例来源:origin: uk.gov.dstl.baleen/baleen-mallet

@Override
 public Instance pipe(Instance carrier) {
  carrier.setTarget(new NullLabel((LabelAlphabet) getTargetAlphabet()));
  return carrier;
 }
}

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

public Instance pipe (Instance carrier) {
  if (carrier.getTarget() != null) {
    if (! (carrier.getTarget() instanceof String)) {
      throw new IllegalArgumentException ("Target must be a string for conversion to Double");
    }
    carrier.setTarget( new Double((String) carrier.getTarget()) );
  }
  return carrier;
}

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

public Instance pipe (Instance carrier) {
  if (carrier.getTarget() != null) {
    if (! (carrier.getTarget() instanceof String)) {
      throw new IllegalArgumentException ("Target must be a String for conversion to Integer");
    }
    carrier.setTarget( new Integer((String) carrier.getTarget()) );
  }
  return carrier;
}

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

public Instance pipe (Instance carrier)
 {
  LabelsSequence lbls = (LabelsSequence) carrier.getTarget ();
  carrier.setTarget (new LabelsAssignment (lbls));
  return carrier;
 }
}

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

public Instance pipe (Instance carrier) {
  LabelsSequence lbls = (LabelsSequence) carrier.getTarget ();
LabelAlphabet dict = (LabelAlphabet) getTargetAlphabet ();
if (dict == null) {
 throw new IllegalArgumentException ("dict is null");
}
LabelSequence ls = sliceLabelsSequence (lbls, dict, slice);
carrier.setTarget (ls);
  return carrier;
}

代码示例来源:origin: com.github.steveash.jg2p/jg2p-core

@Override
 public Instance pipe(Instance inst) {
  LabelSequence seq = (LabelSequence) inst.getTarget();
  LabelsSequence sseq = new LabelsSequence(seq);
  LabelsAssignment labels = new LabelsAssignment(sseq);
  inst.setTarget(labels);
  return inst;
 }
}

代码示例来源:origin: com.github.steveash.jg2p/jg2p-core

@Override
public Instance pipe(Instance inst) {
 List<String> source = (List<String>) inst.getData();
 inst.setData(makeTokenSeq(source));
 if (inst.getTarget() != null && updateTarget) {
  List<String> target = (List<String>) inst.getTarget();
  Preconditions.checkState(target.size() == source.size(), "target %s source %s", target, source);
  inst.setTarget(makeTokenSeq(target));
 }
 return inst;
}

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

public Instance pipe (Instance carrier)
{
  if (carrier.getTarget() != null) {
    if (carrier.getTarget() instanceof Label)
      throw new IllegalArgumentException ("Already a label.");
    LabelAlphabet ldict = (LabelAlphabet) getTargetAlphabet();
    carrier.setTarget(ldict.lookupLabel (carrier.getTarget()));
  }
  return carrier;
}

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

public Instance pipe (Instance carrier)
{
  if (carrier.getTarget() != null) {
    if (carrier.getTarget() instanceof Label)
      throw new IllegalArgumentException ("Already a label.");
    LabelAlphabet ldict = (LabelAlphabet) getTargetAlphabet();
    carrier.setTarget(ldict.lookupLabel (carrier.getTarget()));
  }
  return carrier;
}

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

/** Take input sequence from instance.data and put the output sequence in instance.target. 
 *  Like transduce(Instance), but put best output sequence into instance.target rather than instance.data. */
// TODO Consider a different method name. 
public Instance label (Instance instance)
{
  if (inputPipe != null)
    instance = inputPipe.instanceFrom(instance);
  // TODO Use MaxLatticeFactory instead of hardcoding 
  instance.setTarget(new MaxLatticeDefault(this, (Sequence)instance.getData()).bestOutputSequence());
  if (outputPipe != null)
    instance = outputPipe.instanceFrom(instance);
  return instance;
}

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

public void unhideAllLabels ()
{
  for (int i = 0; i < this.size(); i++) {
    Instance instance = this.get(i);
    Object t;
    if (instance.getTarget() == null && (t=instance.getProperty(TARGET_PROPERTY)) != null) {
      instance.unLock();
      instance.setTarget(t);
      instance.lock();
    }
  }
}

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

public void unhideAllLabels ()
{
  for (int i = 0; i < this.size(); i++) {
    Instance instance = this.get(i);
    Object t;
    if (instance.getTarget() == null && (t=instance.getProperty(TARGET_PROPERTY)) != null) {
      instance.unLock();
      instance.setTarget(t);
      instance.lock();
    }
  }
}

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

public void unhideAllLabels ()
{
  for (int i = 0; i < this.size(); i++) {
    Instance instance = this.get(i);
    Object t;
    if (instance.getTarget() == null && (t=instance.getProperty(TARGET_PROPERTY)) != null) {
      instance.unLock();
      instance.setTarget(t);
      instance.lock();
    }
  }
}

相关文章