//------------------------------------------------------------------------------ // // // This file was automatically generated by SWIG (http://www.swig.org). // Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. //------------------------------------------------------------------------------ public class Trainer : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; internal Trainer(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Trainer obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } ~Trainer() { Dispose(); } public virtual void Dispose() { lock(this) { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; crfsuitePINVOKE.delete_Trainer(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } global::System.GC.SuppressFinalize(this); } } public Trainer() : this(crfsuitePINVOKE.new_Trainer(), true) { if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); SwigDirectorConnect(); } public void clear() { crfsuitePINVOKE.Trainer_clear(swigCPtr); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); } public void append(ItemSequence xseq, StringList yseq, int group) { crfsuitePINVOKE.Trainer_append(swigCPtr, ItemSequence.getCPtr(xseq), StringList.getCPtr(yseq), group); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); } public bool select(string algorithm, string type) { bool ret = crfsuitePINVOKE.Trainer_select(swigCPtr, algorithm, type); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); return ret; } public int train(string model, int holdout) { int ret = crfsuitePINVOKE.Trainer_train(swigCPtr, model, holdout); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); return ret; } public StringList params_() { StringList ret = new StringList(crfsuitePINVOKE.Trainer_params_(swigCPtr), true); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); return ret; } public void set(string name, string value) { crfsuitePINVOKE.Trainer_set(swigCPtr, name, value); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); } public string get(string name) { string ret = crfsuitePINVOKE.Trainer_get(swigCPtr, name); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); return ret; } public string help(string name) { string ret = crfsuitePINVOKE.Trainer_help(swigCPtr, name); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); return ret; } public virtual void message(string msg) { if (SwigDerivedClassHasMethod("message", swigMethodTypes0)) crfsuitePINVOKE.Trainer_messageSwigExplicitTrainer(swigCPtr, msg); else crfsuitePINVOKE.Trainer_message(swigCPtr, msg); if (crfsuitePINVOKE.SWIGPendingException.Pending) throw crfsuitePINVOKE.SWIGPendingException.Retrieve(); } private void SwigDirectorConnect() { if (SwigDerivedClassHasMethod("message", swigMethodTypes0)) swigDelegate0 = new SwigDelegateTrainer_0(SwigDirectormessage); crfsuitePINVOKE.Trainer_director_connect(swigCPtr, swigDelegate0); } private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) { global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null); bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(Trainer)); return hasDerivedMethod; } private void SwigDirectormessage(string msg) { message(msg); } public delegate void SwigDelegateTrainer_0(string msg); private SwigDelegateTrainer_0 swigDelegate0; private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(string) }; }