Example #1
0
        public static void Scan(Document doc, LineList ll)
        {
            ll.Clear();
            uint Index = 0;

            foreach (Section section in doc.Sections)
            {
                foreach (Paragraph paragraph in section.Paragraphs)
                {
                    string            sb = paragraph.Text;
                    Sentence.InfoType tp = Sentence.InfoType.Head;
                    if (sb != null)
                    {
                        uint NowPos  = 0;
                        uint LastPos = 0;
                        foreach (char c in sb.ToString())
                        {
                            switch (c)
                            {
                            case '.':
                            case '。':
                            case '!':
                            case '!':
                            case '?':
                            case '?':
                                NowPos++;
                                Index++;
                                ll.Add(Index, tp, sb.ToString().Substring((int)LastPos, (int)NowPos - (int)LastPos));
                                tp      = Sentence.InfoType.Null;
                                LastPos = NowPos;
                                break;

                            default:
                                NowPos++;
                                break;
                            }
                        }
                    }
                    char[] tag = { '.', '。', '!', '!', '?', '?' };
                    if (sb.IndexOfAny(tag) == -1 && sb.Trim() != "")
                    {
                        Index++;
                        ll.Add(Index, Sentence.InfoType.Head, sb.ToString());
                    }
                }
            }
        }
Example #2
0
 public void Add(uint Index, Sentence.InfoType Info, string Text)
 {
     TheList.Add(new Sentence(Index, Info, Text));
 }