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

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

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

Instance.getName介绍

暂无

代码示例

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

public String[] getDocumentNames() {
  String[] docNames = new String[ data.size() ];
  for (int doc = 0; doc < docNames.length; doc++) {
    docNames[doc] = (String) data.get(doc).instance.getName();
  }
  return docNames;
}

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

public String[] getDocumentNames() {
  String[] docNames = new String[ data.size() ];
  for (int doc = 0; doc < docNames.length; doc++) {
    docNames[doc] = (String) data.get(doc).instance.getName();
  }
  return docNames;
}

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

public String[] getDocumentNames() {
  String[] docNames = new String[ data.size() ];
  for (int doc = 0; doc < docNames.length; doc++) {
    docNames[doc] = (String) data.get(doc).instance.getName();
  }
  return docNames;
}

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

public static void main(String[] args) throws Exception {
  InstanceList instances = InstanceList.load(new File(args[0]));
  for (Instance instance: instances) {
    System.out.println("Name: " + instance.getName());
    System.out.println("Target: " + instance.getTarget());
    System.out.println("Data: " + instance.getData());
  }
}

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

public static void main(String[] args) throws Exception {
  InstanceList instances = InstanceList.load(new File(args[0]));
  for (Instance instance: instances) {
    System.out.println("Name: " + instance.getName());
    System.out.println("Target: " + instance.getTarget());
    System.out.println("Data: " + instance.getData());
  }
}

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

public void testOne () {
 Iterator iter = new PatternMatchIterator( data, Pattern.compile("<p>(.+?)</p>", Pattern.DOTALL));
 int i=0;
 while (iter.hasNext()) {
  Instance inst = (Instance) iter.next();
  System.out.println( inst.getName() + " : " + inst.getData() );
  if (i++==0)
   assertTrue (inst.getData().equals("Inside inside inside"));
  else
   assertTrue (inst.getData().equals("inside\ninside"));
 }
}

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

public void testOne () {
 Iterator iter = new PatternMatchIterator( data, Pattern.compile("<p>(.+?)</p>", Pattern.DOTALL));
 int i=0;
 while (iter.hasNext()) {
  Instance inst = (Instance) iter.next();
  System.out.println( inst.getName() + " : " + inst.getData() );
  if (i++==0)
   assertTrue (inst.getData().equals("Inside inside inside"));
  else
   assertTrue (inst.getData().equals("inside\ninside"));
 }
}

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

public void dumpUnrolledGraphs (InstanceList lst)
{
 for (int i = 0; i < lst.size(); i++) {
  Instance inst = lst.get (i);
  System.out.println("INSTANCE "+i+" : "+inst.getName ());
  UnrolledGraph unrolled = unroll (inst);
  dumpOneGraph (unrolled);
 }
}

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

public void dumpUnrolledGraphs (InstanceList lst)
{
 for (int i = 0; i < lst.size(); i++) {
  Instance inst = lst.get (i);
  System.out.println("INSTANCE "+i+" : "+inst.getName ());
  UnrolledGraph unrolled = unroll (inst);
  dumpOneGraph (unrolled);
 }
}

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

public void dumpUnrolledGraphs (InstanceList lst)
{
 for (int i = 0; i < lst.size(); i++) {
  Instance inst = lst.get (i);
  System.out.println("INSTANCE "+i+" : "+inst.getName ());
  UnrolledGraph unrolled = unroll (inst);
  dumpOneGraph (unrolled);
 }
}

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

private static void printTrialClassification(Trial trial)
{
  for (Classification c : trial) {
    Instance instance = c.getInstance();
    System.out.print(instance.getName() + " " + instance.getTarget() + " ");
    Labeling labeling = c.getLabeling();
    for (int j = 0; j < labeling.numLocations(); j++){
      System.out.print(labeling.getLabelAtRank(j).toString() + ":" + labeling.getValueAtRank(j) + " ");
    }
    System.out.println();
  }
}

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

private static void printTrialClassification(Trial trial)
{
  for (Classification c : trial) {
    Instance instance = c.getInstance();
    System.out.print(instance.getName() + " " + instance.getTarget() + " ");
    Labeling labeling = c.getLabeling();
    for (int j = 0; j < labeling.numLocations(); j++){
      System.out.print(labeling.getLabelAtRank(j).toString() + ":" + labeling.getValueAtRank(j) + " ");
    }
    System.out.println();
  }
}

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

private static void printTrialClassification(Trial trial)
{
  for (Classification c : trial) {
    Instance instance = c.getInstance();
    System.out.print(instance.getName() + " " + instance.getTarget() + " ");
    Labeling labeling = c.getLabeling();
    for (int j = 0; j < labeling.numLocations(); j++){
      System.out.print(labeling.getLabelAtRank(j).toString() + ":" + labeling.getValueAtRank(j) + " ");
    }
    System.out.println();
  }
}

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

public Instance next ()
{
 Instance inst = subIt.next ();
 inst = pipe.pipe (inst);
 return new Instance (inst.getData (), inst.getTarget (), inst.getName (), inst.getSource ());
}

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

public Instance next ()
{
 Instance inst = subIt.next ();
 inst = pipe.pipe (inst);
 return new Instance (inst.getData (), inst.getTarget (), inst.getName (), inst.getSource ());
}

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

public Instance next ()
{
 Instance inst = subIt.next ();
 inst = pipe.pipe (inst);
 return new Instance (inst.getData (), inst.getTarget (), inst.getName (), inst.getSource ());
}

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

private static void printTrialClassification(Trial trial)
{
  for (int i = 0; i < trial.size(); i++) {
    Instance instance = trial.get(i).getInstance();
    System.out.print(instance.getName() + " " + instance.getTarget() + " ");
    Labeling labeling = trial.get(i).getLabeling();
    for (int j = 0; j < labeling.numLocations(); j++){
      System.out.print(labeling.getLabelAtRank(j).toString() + ":" + labeling.getValueAtRank(j) + " ");
    }
    System.out.println();
  }
}

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

private static void printTrialClassification(Trial trial)
{
  for (int i = 0; i < trial.size(); i++) {
    Instance instance = trial.get(i).getInstance();
    System.out.print(instance.getName() + " " + instance.getTarget() + " ");
    Labeling labeling = trial.get(i).getLabeling();
    for (int j = 0; j < labeling.numLocations(); j++){
      System.out.print(labeling.getLabelAtRank(j).toString() + ":" + labeling.getValueAtRank(j) + " ");
    }
    System.out.println();
  }
}

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

private static void printTrialClassification(Trial trial)
{
  for (int i = 0; i < trial.size(); i++) {
    Instance instance = trial.get(i).getInstance();
    System.out.print(instance.getName() + " " + instance.getTarget() + " ");
    Labeling labeling = trial.get(i).getLabeling();
    for (int j = 0; j < labeling.numLocations(); j++){
      System.out.print(labeling.getLabelAtRank(j).toString() + ":" + labeling.getValueAtRank(j) + " ");
    }
    System.out.println();
  }
}

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

private void writeClassificationToMongo(List<Classification> classify) {
 classify.forEach(
   classification -> {
    Instance instance = classification.getInstance();
    documentsCollection.findOneAndUpdate(
      Filters.eq(new ObjectId((String) instance.getName())),
      Updates.set(
        CLASSIFICATION_FIELD, classification.getLabeling().getBestLabel().toString()));
   });
}

相关文章