// = null; /// <summary> /// reads the tokenFactory and tokensAnnotationClassName from /// <see cref="SeqClassifierFlags"/> /// </summary> public virtual void Init(SeqClassifierFlags flags) { if (flags.tokensAnnotationClassName != null) { this.tokensAnnotationClassName = flags.tokensAnnotationClassName; } else { this.tokensAnnotationClassName = "edu.stanford.nlp.ling.CoreAnnotations$TokensAnnotation"; } if (flags.tokenFactory != null) { try { this.tokenFactory = (ICoreTokenFactory <IN>)System.Activator.CreateInstance(Sharpen.Runtime.GetType(flags.tokenFactory)); } catch (Exception e) { throw new Exception(e); } } else { this.tokenFactory = (ICoreTokenFactory <IN>) new CoreLabelTokenFactory(); } Init(flags, this.tokenFactory, this.tokensAnnotationClassName); }
public virtual void Init(string name, Properties props) { string prefix = (name == null) ? string.Empty : name + "."; string delimiterRegex = props.GetProperty(prefix + "delimiter"); if (delimiterRegex != null) { delimiterPattern = Pattern.Compile(delimiterRegex); } replaceWhitespace = PropertiesUtils.GetBool(props, prefix + "replaceWhitespace", replaceWhitespace); string mapString = props.GetProperty(prefix + "columns"); tokensAnnotationClassName = props.GetProperty(prefix + "tokens", "edu.stanford.nlp.ling.CoreAnnotations$TokensAnnotation"); string tokenFactoryClassName = props.GetProperty(prefix + "tokenFactory"); if (tokenFactoryClassName != null) { try { this.tokenFactory = (ICoreTokenFactory <IN>)System.Activator.CreateInstance(Sharpen.Runtime.GetType(tokenFactoryClassName)); } catch (Exception e) { throw new Exception(e); } } else { this.tokenFactory = (ICoreTokenFactory <IN>) new CoreLabelTokenFactory(); } Init(mapString, this.tokenFactory, this.tokensAnnotationClassName); }
public virtual void Init(string map, ICoreTokenFactory <IN> tokenFactory, string tokensAnnotationClassName) { this.map = StringUtils.MapStringToArray(map); this.tokenFactory = tokenFactory; this.tokensAnnotationClassName = tokensAnnotationClassName; }
public virtual void Init(SeqClassifierFlags flags, ICoreTokenFactory <IN> tokenFactory, string tokensAnnotationClassName) { this.map = StringUtils.MapStringToArray(flags.map); this.tokenFactory = tokenFactory; this.tokensAnnotationClassName = tokensAnnotationClassName; }