예제 #1
0
        /// <summary>
        /// Parses the string item.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="content">The content.</param>
        private void ParseStringItem(Text text, string content)
        {
            Page page = GetPage(text);;

            if (!String.IsNullOrWhiteSpace(content))
            {
                StringItem stringItemObject = new StringItem();

                MatchCollection sentenceItemCollection = Regex.Matches(content, @"(\S+)", RegexOptions.Multiline);
                foreach (Match sentenceItemMatch in sentenceItemCollection)
                {
                    MatchCollection potentialWordCollection = Regex.Matches(sentenceItemMatch.Value, @"([a-zA-Z]+)");
                    foreach (Match potentialWordItemMatch in potentialWordCollection)
                    {
                        Group  groupWord = potentialWordItemMatch.Groups[1];
                        string word      = groupWord.Value;

                        if (!String.IsNullOrEmpty(word))
                        {
                            Word item = new Word(word);
                            stringItemObject.Add(item);
                        }
                    }
                }
                page.Add(stringItemObject);
            }
        }