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

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

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

Alphabet.contains介绍

暂无

代码示例

代码示例来源:origin: org.cleartk/cleartk-ml-mallet

public Instance toInstance(List<Feature> features) throws CleartkEncoderException {
  List<NameNumber> nameNumbers = featuresEncoder.encodeAll(features);

  Iterator<NameNumber> nameNumberIterator = nameNumbers.iterator();
  while (nameNumberIterator.hasNext()) {
   NameNumber nameNumber = nameNumberIterator.next();
   if (!alphabet.contains(nameNumber.name))
    nameNumberIterator.remove();
  }

  String[] keys = new String[nameNumbers.size()];
  double[] values = new double[nameNumbers.size()];

  for (int i = 0; i < nameNumbers.size(); i++) {
   NameNumber nameNumber = nameNumbers.get(i);
   keys[i] = nameNumber.name;
   values[i] = nameNumber.number.doubleValue();
  }

  int[] keyIndices = FeatureVector.getObjectIndices(keys, alphabet, true);
  FeatureVector fv = new FeatureVector(alphabet, keyIndices, values);

  Instance instance = new Instance(fv, null, null, null);
  return instance;
 }
}

代码示例来源:origin: ClearTK/cleartk

public Instance toInstance(List<Feature> features) throws CleartkEncoderException {
  List<NameNumber> nameNumbers = featuresEncoder.encodeAll(features);

  Iterator<NameNumber> nameNumberIterator = nameNumbers.iterator();
  while (nameNumberIterator.hasNext()) {
   NameNumber nameNumber = nameNumberIterator.next();
   if (!alphabet.contains(nameNumber.name))
    nameNumberIterator.remove();
  }

  String[] keys = new String[nameNumbers.size()];
  double[] values = new double[nameNumbers.size()];

  for (int i = 0; i < nameNumbers.size(); i++) {
   NameNumber nameNumber = nameNumbers.get(i);
   keys[i] = nameNumber.name;
   values[i] = nameNumber.number.doubleValue();
  }

  int[] keyIndices = FeatureVector.getObjectIndices(keys, alphabet, true);
  FeatureVector fv = new FeatureVector(alphabet, keyIndices, values);

  Instance instance = new Instance(fv, null, null, null);
  return instance;
 }
}

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

if (queryWord != null && vocabulary.contains(queryWord)) {
  findClosest(copy(queryWord));

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

if (alphabet.contains(token) && length >= minimumLength) {
      tokenBuffer[numTokens] = alphabet.lookupIndex(token);
      numTokens++;
if (alphabet.contains(token) && length >= minimumLength) {
  tokenBuffer[numTokens] = alphabet.lookupIndex(token);
  numTokens++;

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

if (alphabet.contains(token) && length >= minimumLength) {
      tokenBuffer[numTokens] = alphabet.lookupIndex(token);
      numTokens++;
if (alphabet.contains(token) && length >= minimumLength) {
  tokenBuffer[numTokens] = alphabet.lookupIndex(token);
  numTokens++;

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

boolean[] keepers = new boolean[length];
for (int i = 0; i < length; i++) {
  if (newAlphabet.contains(dictionary.lookupObject(features[i]))) {
    keepers[i] = true;
    newLength++;

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

if (alphabet.contains(token) && length >= minimumLength) {
      tokenBuffer[numTokens] = alphabet.lookupIndex(token);
      numTokens++;
if (alphabet.contains(token) && length >= minimumLength) {
  tokenBuffer[numTokens] = alphabet.lookupIndex(token);
  numTokens++;

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

boolean[] keepers = new boolean[length];
for (int i = 0; i < length; i++) {
  if (newAlphabet.contains(dictionary.lookupObject(features[i]))) {
    keepers[i] = true;
    newLength++;

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

boolean[] keepers = new boolean[length];
for (int i = 0; i < length; i++) {
  if (newAlphabet.contains(dictionary.lookupObject(features[i]))) {
    keepers[i] = true;
    newLength++;

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

if (newAlphabet.contains(oldAlphabet.lookupObject(feature))) {
  bs.set(feature);

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

if (newAlphabet.contains(oldAlphabet.lookupObject(feature))) {
  bs.set(feature);

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

if (newAlphabet.contains(oldAlphabet.lookupObject(feature))) {
  bs.set(feature);

相关文章