Esempio n. 1
0
        /// <summary>
        /// Gets or makes neutral <see cref="termQualification"/>
        /// </summary>
        /// <param name="word">The word to be evaluated.</param>
        /// <param name="list">The list with qualification definitions</param>
        /// <returns></returns>
        public termQualification EvaluateToTerm(String word, termQualificationList list)
        {
            if (list == null)
            {
                return(new termQualification(word, 0));
            }

            foreach (termQualification tq in list)
            {
                if (tq.lemmaForm.Equals(word, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(tq);
                }
            }


            foreach (var tq in list)
            {
                if (similarity.GetResult(tq.lemmaForm, word) > treshold)
                {
                    return(tq);
                }
            }

            return(new termQualification(word, 0));
        }
Esempio n. 2
0
        /// <summary>
        /// Evaluates the specified word
        /// </summary>
        /// <param name="word">The word.</param>
        /// <param name="list">Qualification list</param>
        /// <returns></returns>
        public termQualificationAnswer Evaluate(String word, termQualificationList list)
        {
            termQualification tq = EvaluateToTerm(word, list);



            return((termQualificationAnswer)tq.score);
        }
Esempio n. 3
0
        /// <summary>
        /// Saves the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        public void Save(String path)
        {
            FileInfo fi = path.getWritableFile(imbSCI.Data.enums.getWritableFileMode.appendFile, null);


            if (File.Exists(path))
            {
                termQualificationList tmp = new termQualificationList();
                tmp.Load(path);
                foreach (var v in tmp)
                {
                    if (!this.Any(x => x.lemmaForm == v.lemmaForm))
                    {
                        Add(v);
                    }
                }
            }


            String code = ToString();

            File.WriteAllText(path, code);
        }