示例#1
0
        public static LinearParseResult FromHierarchyParseResult(HierarchyParseResult hierarchyResult)
        {
            var result = new LinearParseResult();

            AddParagraphsFromHierarchy(hierarchyResult, result, 0);

            return(result);
        }
示例#2
0
        private static void AddParagraphsFromHierarchy(HierarchyParseResult hierarchyResult, LinearParseResult result, int depth)
        {
            foreach (var paragraph in hierarchyResult.ParagraphResults)
            {
                result.Paragraphs.AddLast(new ParagraphParseResultExt(paragraph, depth));
            }

            foreach (var childHierarchy in hierarchyResult.ChildHierarchyResults)
            {
                AddParagraphsFromHierarchy(childHierarchy, result, depth + 1);
            }
        }