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

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

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

Alphabet.stopGrowth介绍

暂无

代码示例

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

public HMM(Alphabet inputAlphabet, Alphabet outputAlphabet) {
  inputAlphabet.stopGrowth();
  logger.info("HMM input dictionary size = " + inputAlphabet.size());
  this.inputAlphabet = inputAlphabet;
  this.outputAlphabet = outputAlphabet;
}

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

/** Constructor that takes an alphabet representing the
 *    meaning of each dimension
 */
public Dirichlet (double[] alphas, Alphabet dict)
{
  this(alphas);
  if (dict != null && alphas.length != dict.size())
    throw new IllegalArgumentException ("alphas and dict sizes do not match.");
  this.dict = dict;
  if (dict != null)
    dict.stopGrowth();
}

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

/** Constructor that takes an alphabet representing the
 *    meaning of each dimension
 */
public Dirichlet (double[] alphas, Alphabet dict)
{
  this(alphas);
  if (dict != null && alphas.length != dict.size())
    throw new IllegalArgumentException ("alphas and dict sizes do not match.");
  this.dict = dict;
  if (dict != null)
    dict.stopGrowth();
}

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

public HMM(Alphabet inputAlphabet, Alphabet outputAlphabet) {
  inputAlphabet.stopGrowth();
  logger.info("HMM input dictionary size = " + inputAlphabet.size());
  this.inputAlphabet = inputAlphabet;
  this.outputAlphabet = outputAlphabet;
}

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

/**
 *    A symmetric Dirichlet with alpha_i = <code>alpha</code> and the 
 *    number of dimensions of the given alphabet.
 */
public Dirichlet (Alphabet dict, double alpha)
{
  this(dict.size(), alpha);
  this.dict = dict;
  dict.stopGrowth();
}

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

/**
 *    A symmetric Dirichlet with alpha_i = <code>alpha</code> and the 
 *    number of dimensions of the given alphabet.
 */
public Dirichlet (Alphabet dict, double alpha)
{
  this(dict.size(), alpha);
  this.dict = dict;
  dict.stopGrowth();
}

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

/** Constructor that takes an alphabet representing the
 *    meaning of each dimension
 */
public Dirichlet (double[] alphas, Alphabet dict)
{
  this(alphas);
  if (dict != null && alphas.length != dict.size())
    throw new IllegalArgumentException ("alphas and dict sizes do not match.");
  this.dict = dict;
  if (dict != null)
    dict.stopGrowth();
}

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

/**
 *    A symmetric Dirichlet with alpha_i = <code>alpha</code> and the 
 *    number of dimensions of the given alphabet.
 */
public Dirichlet (Alphabet dict, double alpha)
{
  this(dict.size(), alpha);
  this.dict = dict;
  dict.stopGrowth();
}

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

public HMM(Alphabet inputAlphabet, Alphabet outputAlphabet) {
  inputAlphabet.stopGrowth();
  logger.info("HMM input dictionary size = " + inputAlphabet.size());
  this.inputAlphabet = inputAlphabet;
  this.outputAlphabet = outputAlphabet;
}

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

public void readModel(InputStream is) throws IOException, ClassNotFoundException {
  final GZIPInputStream gin = new GZIPInputStream(is);
  final ObjectInputStream ois = new ObjectInputStream(gin);
  model = (CRF) ois.readObject();
  trained = true;
  model.getInputPipe().getDataAlphabet().stopGrowth();
  ois.close();
}

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

public void trainFor(Collection<Alignment> inputs) {
 // this pipe is the default pipe with new alphabet
 Stopwatch watch = Stopwatch.createStarted();
 trainRound(inputs, new Alphabet(), 0);
 crf.getInputAlphabet().stopGrowth();
 crf.getOutputAlphabet().stopGrowth();
 watch.stop();
 log.info("Training took " + watch);
}

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

public CRF (Alphabet inputAlphabet, Alphabet outputAlphabet)
{
  super (new Noop(inputAlphabet, outputAlphabet), null);
  inputAlphabet.stopGrowth();
  logger.info ("CRF input dictionary size = "+inputAlphabet.size());
  //xxx outputAlphabet.stopGrowth();
  this.inputAlphabet = inputAlphabet;
  this.outputAlphabet = outputAlphabet;
}

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

public CRF (Alphabet inputAlphabet, Alphabet outputAlphabet)
{
  super (new Noop(inputAlphabet, outputAlphabet), null);
  inputAlphabet.stopGrowth();
  logger.info ("CRF input dictionary size = "+inputAlphabet.size());
  //xxx outputAlphabet.stopGrowth();
  this.inputAlphabet = inputAlphabet;
  this.outputAlphabet = outputAlphabet;
}

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

public CRF (Alphabet inputAlphabet, Alphabet outputAlphabet)
{
  super (new Noop(inputAlphabet, outputAlphabet), null);
  inputAlphabet.stopGrowth();
  logger.info ("CRF input dictionary size = "+inputAlphabet.size());
  //xxx outputAlphabet.stopGrowth();
  this.inputAlphabet = inputAlphabet;
  this.outputAlphabet = outputAlphabet;
}

代码示例来源:origin: edu.washington.cs.knowitall/reverb-core

private void setupClassifier(String trainingdata) {
  try {
    crf_input = new ObjectInputStream(ResourceUtils.loadResource(
        trainingdata, this.getClass()));
    crf = (CRF) crf_input.readObject();
    crf_input.close();
  } catch (FileNotFoundException e1) {
    e1.printStackTrace();
  } catch (IOException e1) {
    e1.printStackTrace();
  } catch (ClassNotFoundException e) {
    e.printStackTrace();
  }
  crf.getInputAlphabet().stopGrowth();
  crf.getOutputAlphabet().stopGrowth();
  crf_pipe = crf.getInputPipe();
  crf_pipe.setTargetProcessing(false);
  crf_estimator = new ViterbiConfidenceEstimator(crf);
}

代码示例来源:origin: knowitall/reverb

private void setupClassifier(String trainingdata) {
  try {
    crf_input = new ObjectInputStream(ResourceUtils.loadResource(
        trainingdata, this.getClass()));
    crf = (CRF) crf_input.readObject();
    crf_input.close();
  } catch (FileNotFoundException e1) {
    e1.printStackTrace();
  } catch (IOException e1) {
    e1.printStackTrace();
  } catch (ClassNotFoundException e) {
    e.printStackTrace();
  }
  crf.getInputAlphabet().stopGrowth();
  crf.getOutputAlphabet().stopGrowth();
  crf_pipe = crf.getInputPipe();
  crf_pipe.setTargetProcessing(false);
  crf_estimator = new ViterbiConfidenceEstimator(crf);
}

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

private TransducerTrainer trainOnce(Pipe pipe, InstanceList trainData) {
  Stopwatch watch = Stopwatch.createStarted();

  CRF crf = new CRF(pipe, null);
  crf.addOrderNStates(trainData, new int[]{1}, null, null, null, null, false);
  crf.addStartState();

  log.info("Starting alignTag training...");
  CRFTrainerByThreadedLabelLikelihood trainer = new CRFTrainerByThreadedLabelLikelihood(crf, 8);
  trainer.setGaussianPriorVariance(2);
//    trainer.setUseSomeUnsupportedTrick(false);
  trainer.train(trainData);
  trainer.shutdown();
  watch.stop();

  log.info("Align Tag CRF Training took " + watch.toString());
  crf.getInputAlphabet().stopGrowth();
  crf.getOutputAlphabet().stopGrowth();
  return trainer;
 }

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

/**
 * Returns a new alphabet that contains only features at or above 
 *  the specified limit.
 */
public Alphabet getPrunedAlphabet(int minimumCount) {
    
  Alphabet currentAlphabet = getDataAlphabet();
  Alphabet prunedAlphabet = new Alphabet();
  for (int feature = 0; feature < currentAlphabet.size(); feature++) {
    if (counter.get(feature) >= minimumCount) {
      prunedAlphabet.lookupObject(currentAlphabet.lookupIndex(feature));
    }
  }
  prunedAlphabet.stopGrowth();
  return prunedAlphabet;
    
}

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

/**
 * Returns a new alphabet that contains only features at or above 
 *  the specified limit.
 */
public Alphabet getPrunedAlphabet(int minimumCount) {
    
  Alphabet currentAlphabet = getDataAlphabet();
  Alphabet prunedAlphabet = new Alphabet();
  for (int feature = 0; feature < currentAlphabet.size(); feature++) {
    if (counter.get(feature) >= minimumCount) {
      prunedAlphabet.lookupIndex(currentAlphabet.lookupObject(feature));
    }
  }
  prunedAlphabet.stopGrowth();
  return prunedAlphabet;
    
}

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

/**
 * Returns a new alphabet that contains only features at or above 
 *  the specified limit.
 */
public Alphabet getPrunedAlphabet(int minimumCount) {
    
  Alphabet currentAlphabet = getDataAlphabet();
  Alphabet prunedAlphabet = new Alphabet();
  for (int feature = 0; feature < currentAlphabet.size(); feature++) {
    if (counter.get(feature) >= minimumCount) {
      prunedAlphabet.lookupObject(currentAlphabet.lookupIndex(feature));
    }
  }
  prunedAlphabet.stopGrowth();
  return prunedAlphabet;
    
}

相关文章