All Downloads are FREE. Search and download functionalities are using the official Maven repository.

third_party.org.chokkan.crfsuite.Trainer Maven / Gradle / Ivy

Go to download

Jcrfsuite is a Java interface for crfsuite, a fast implementation of Conditional Random Fields, using SWIG and class injection technique

The newest version!
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.4
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package third_party.org.chokkan.crfsuite;

public class Trainer {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public Trainer(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(Trainer obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        crfsuiteJNI.delete_Trainer(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  protected void swigDirectorDisconnect() {
    swigCMemOwn = false;
    delete();
  }

  public void swigReleaseOwnership() {
    swigCMemOwn = false;
    crfsuiteJNI.Trainer_change_ownership(this, swigCPtr, false);
  }

  public void swigTakeOwnership() {
    swigCMemOwn = true;
    crfsuiteJNI.Trainer_change_ownership(this, swigCPtr, true);
  }

  public Trainer() {
    this(crfsuiteJNI.new_Trainer(), true);
    crfsuiteJNI.Trainer_director_connect(this, swigCPtr, swigCMemOwn, true);
  }

  public void clear() {
    crfsuiteJNI.Trainer_clear(swigCPtr, this);
  }

  public void append(ItemSequence xseq, StringList yseq, int group) {
    crfsuiteJNI.Trainer_append(swigCPtr, this, ItemSequence.getCPtr(xseq), xseq, StringList.getCPtr(yseq), yseq, group);
  }

  public boolean select(String algorithm, String type) {
    return crfsuiteJNI.Trainer_select(swigCPtr, this, algorithm, type);
  }

  public int train(String model, int holdout) {
    return crfsuiteJNI.Trainer_train(swigCPtr, this, model, holdout);
  }

  public StringList params() {
    return new StringList(crfsuiteJNI.Trainer_params(swigCPtr, this), true);
  }

  public void set(String name, String value) {
    crfsuiteJNI.Trainer_set(swigCPtr, this, name, value);
  }

  public String get(String name) {
    return crfsuiteJNI.Trainer_get(swigCPtr, this, name);
  }

  public String help(String name) {
    return crfsuiteJNI.Trainer_help(swigCPtr, this, name);
  }

  public void message(String msg) {
    if (getClass() == Trainer.class) crfsuiteJNI.Trainer_message(swigCPtr, this, msg); else crfsuiteJNI.Trainer_messageSwigExplicitTrainer(swigCPtr, this, msg);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy