Exemple #1
0
        public static List <Word> Parse(List <TextLine> textLines)
        {
            List <Word> wordsInText = new List <Word>();

            for (int i = 0; i < textLines.Count; i++)
            {
                foreach (var item in textLines.ElementAt(i).Items)
                {
                    if (item is Interfaces.IWord)
                    {
                        if (!wordsInText.Contains((item as Interfaces.IWord), new EqualsWord()))
                        {
                            (item as Word).numbersOfLines.Add(i + 1);
                            (item as Word).CountInText++;
                            wordsInText.Add(item as Word);
                        }
                        else
                        {
                            Interfaces.IWord word = wordsInText.Find(x => (x as Word).Value.ToUpper() == (item as Word).Value.ToUpper());
                            if (!(word as Word).numbersOfLines.Contains(i + 1))
                            {
                                (word as Word).numbersOfLines.Add(i + 1);
                            }
                            (word as Word).CountInText++;
                        }
                    }
                }
            }
            return(wordsInText);
        }
Exemple #2
0
 public void AddWord(Interfaces.IWord word)
 {
     if (word.Length > 0)
     {
         Items.Add((word as Word));
     }
 }
        public bool Predicate(Interfaces.IWord word)
        {
            // if no filter set word is coorect
            if (emotions.Count + synonyms.Count == 0)
            {
                return(true);
            }
            // filter
            foreach (string e in emotions)
            {
                if (!word.Emotions.Picked.Contains(e))
                {
                    return(false);
                }
            }
            foreach (string s in synonyms)
            {
                if (!word.Synonyms.Picked.Contains(s))
                {
                    return(false);
                }
            }

            return(true);
        }