public static LinearParseResult FromHierarchyParseResult(HierarchyParseResult hierarchyResult) { var result = new LinearParseResult(); AddParagraphsFromHierarchy(hierarchyResult, result, 0); return(result); }
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); } }