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

x33g5p2x  于2022-01-16 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(88)

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

Alphabet.toArray介绍

[英]Returns an array containing all the entries in the Alphabet. The runtime type of the returned array is the runtime type of in. If in is large enough to hold everything in the alphabet, then it it used. The returned array is such that for all entries obj, ret[lookupIndex(obj)] = obj .
[中]返回包含字母表中所有项目的数组。返回数组的运行时类型是中的运行时类型。如果in足够大,可以容纳字母表中的所有内容,那么它就使用了。返回的数组使得对于所有条目obj,ret[lookupIndex(obj)]=obj。

代码示例

代码示例来源:origin: de.julielab/julielab-topic-modeling

public Object[] getVocabulary(Model model) {
    ParallelTopicModel malletModel = model.malletModel;
    Alphabet alphabet = malletModel.getAlphabet();
    Object[] alphabetArray = alphabet.toArray();
    return alphabetArray;
  }
}

代码示例来源:origin: de.julielab/jcore-jnet-ae

/**
   * prints out the tagset used in the model 'modelFile'
   */
  public static void printOutputAlphabet(final File modelFile) {
    Object model;
    final NETagger tagger = new NETagger();
    try {
      tagger.readModel(modelFile);
    } catch (final FileNotFoundException e) {
      e.printStackTrace();
    } catch (final IOException e) {
      e.printStackTrace();
    } catch (final ClassNotFoundException e) {
      e.printStackTrace();
    }

    model = tagger.getModel();
    final Alphabet alpha = ((CRF) model).getOutputAlphabet();
    final Object modelLabels[] = alpha.toArray();
    for (final Object modelLabel : modelLabels)
      System.out.println(modelLabel);
  }
}

代码示例来源:origin: de.julielab/jcore-jpos-ae

/**
   * prints out the tagset used in the model 'modelFile'
   *
   * @throws IOException
   * @throws ClassNotFoundException
   * @throws FileNotFoundException
   */
  public static void printTagset(final File modelFile)
      throws FileNotFoundException, ClassNotFoundException, IOException {
    Object model;
    final POSTagger tagger = POSTagger.readModel(modelFile);

    model = tagger.getModel();
    final Alphabet alpha = ((CRF) model).getOutputAlphabet();
    final Object modelLabels[] = alpha.toArray();
    for (final Object modelLabel : modelLabels)
      System.out.println(modelLabel);
  }
}

代码示例来源:origin: de.julielab/jcore-jnet-ae

if (model != null) {
  Alphabet alpha = model.getOutputAlphabet();
  Object modelLabels[] = alpha.toArray();

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

labels[k] = (String) (ilist.getAlphabets()[1].toArray())[k];
labels[k] = (String) (trainingFileIlist.getAlphabets()[1].toArray())[k];

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

labels[k] = (String) (ilist.getAlphabets()[1].toArray())[k];
labels[k] = (String) (trainingFileIlist.getAlphabets()[1].toArray())[k];

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

labels[k] = (String) (ilist.getAlphabets()[1].toArray())[k];
labels[k] = (String) (trainingFileIlist.getAlphabets()[1].toArray())[k];

相关文章