parser_common¶
topic_segmentation.news_dataset.parser_common
Shared HTML cleanup and saved-page I/O for the outlet parsers.
clean_inner_html(element, origin)
¶
Remove presentation attributes and resolve relative links without mutating the DOM.
Source code in src/topic_segmentation/news_dataset/parser_common.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
is_link_only_list(element)
¶
Identify lists whose items each have at least 60% linked text.
Source code in src/topic_segmentation/news_dataset/parser_common.py
26 27 28 29 30 31 32 33 34 35 36 37 38 | |
read_articles(directory, parse)
¶
Parse saved pages in filename order, with their editorial metadata.
Source code in src/topic_segmentation/news_dataset/parser_common.py
41 42 43 44 45 46 47 48 | |
unique_articles(records)
¶
Keep the first occurrence of each title and body, before section filtering.
Source code in src/topic_segmentation/news_dataset/parser_common.py
51 52 53 54 55 56 57 58 | |
write_articles(filename, records)
¶
Write articles with at least two sections.
Source code in src/topic_segmentation/news_dataset/parser_common.py
61 62 63 64 65 66 67 | |