public IEnumerable <string> GetKeywords(TextToParse text)
        {
            var keywords = new List <string>();

            if (string.IsNullOrEmpty(text.Text))
            {
                return(keywords);
            }

            var keywordsObjects = KeywordAnalyzer.Analyze(text.Text).Keywords;

            foreach (var kw in keywordsObjects)
            {
                keywords.Add(kw.Word);
            }

            return(keywords);
        }
Exemplo n.º 2
0
        public int Execute()
        {
            try
            {
                string result = "";

                if (UseRegulerExpression)
                {
                    result = Regex.Replace(TextToParse, TextToFind, ReplaceWith);
                }
                else if (IgnoreCase || (UseRegulerExpression && IgnoreCase))
                {
                    result = Regex.Replace(TextToParse, TextToFind, ReplaceWith, RegexOptions.IgnoreCase);
                }
                else
                {
                    if (ActiveEscapeSequence)
                    {
                        result = TextToParse.Replace(TextToFind, @ReplaceWith);
                    }
                    else
                    {
                        result = TextToParse.Replace(TextToFind, ReplaceWith);
                    }
                }


                if (VariableStorage.ReplaceTextVar.ContainsKey(ReplaceTextStoreVar))
                {
                    VariableStorage.ReplaceTextVar.Remove(ReplaceTextStoreVar);
                }

                VariableStorage.ReplaceTextVar.Add(ReplaceTextStoreVar, Tuple.Create(this.ID, result));



                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Exemplo n.º 3
0
        public int Execute()
        {
            try
            {
                string textToParse;
                string textToFind;

                List <int> indexes = new List <int>();


                if (IgnoreCase)
                {
                    textToParse = TextToParse.ToLower();
                    textToFind  = TextToFind.ToLower();
                }
                else
                {
                    textToParse = TextToParse;
                    textToFind  = TextToFind;
                }

                if (UseRegulerExpression)
                {
                    string pattern = textToFind;
                    textToParse = textToParse.Remove(0, StartingPoint + 1);
                    Regex rgx = new Regex(textToFind);

                    foreach (Match match in rgx.Matches(textToParse))
                    {
                        indexes.Add(match.Index);
                    }
                }
                else
                {
                    indexes = FindIndexes(TextToParse + " ", TextToFind, StartingPoint).ToList();
                }


                if (FirstOccurenceOnly && indexes.Count > 1)
                {
                    indexes.RemoveRange(1, indexes.Count - 1);
                }



                if (VariableStorage.FindTextVar.ContainsKey(ResultStoreVar))
                {
                    VariableStorage.FindTextVar.Remove(ResultStoreVar);
                }

                VariableStorage.FindTextVar.Add(ResultStoreVar, Tuple.Create(this.ID, indexes));
                VarCounter++;



                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }