Esempio n. 1
0
        public static NERProperties FromFile(string filePath)
        {
            NERProperties result = new NERProperties();
            Dictionary <string, PropertyInfo> properties = GetPropertiesAndAttributes();

            foreach (string line in File.ReadAllLines(filePath))
            {
                if (string.IsNullOrWhiteSpace(line) || line.Trim().StartsWith("#")) //Skip empty lines & comments
                {
                    continue;
                }

                string[] lineParts = line.Split(new[] { '=' }, 2);
                string   key       = lineParts[0].Trim();
                string   val       = lineParts[1].Trim();

                PropertyInfo property = properties[key];
                property.SetValue(result, Convert.ChangeType(val, property.PropertyType));
            }

            return(result);
        }
Esempio n. 2
0
 public void TrainModel(NERProperties nerProperties)
 {
     RunJava($"edu.stanford.nlp.ie.crf.CRFClassifier {nerProperties.ToArgString()}");
 }