TxT360 / curated.py
omkarenator's picture
fixes
149e56a
raw
history blame
68.7 kB
from fasthtml.common import *
from fasthtml.components import *
from plotly import graph_objects as go
from fh_plotly import plotly2fasthtml
import pandas as pd
import json
from data_viewer import view_data, gen_random_id
from data_viewer import DV, DV2, DVS
from rich import print
import uuid
import plotly.express as px
from fasthtml.components import D_code, D_bibliography, D_appendix, D_cite
overview = (
Div(
H2("Curated Sources Processing"),
H3("What This Section Contains"),
P(
"This section provides a complete discussion on the filtering applied to the 14 curated sources that comprise the non-Common Crawl data section of TxT360. The section is split into the following topic areas: "
),
Ul(
Li("Curated Sources Data Processing Summary", style="margin-bottom: 5px"),
Li(
"Individual Filtering Discussion for Each Source",
style="margin-bottom: 5px",
),
Li(
B("Estimated Reading Time: 25 minutes"),
style="margin-bottom: 5px",
),
),
),
)
curated_sources_intro = Div(
H2("Domain Specific Curated Sources"),
P(
"While massive amount of data can be crawled and obtained from the Internet, there are certain sources contain data in additional formats (e.g. PDF documents), or organized and published as official dumps (e.g. Wikipedia). We refer to these sources as curated sources. These dataset often comprises high-quality data that contain domain-specificity, such as academic publications or domain specific discussions. TxT360 was strongly influenced by The Pile",
D_cite(bibtex_key="thepile"),
" regarding both inclusion of the dataset and filtering techniques.",
),
P(
"These sources, such as Arxiv, Wikipedia, and Stack Exchange, provide high quality data. And as mentioned above, they are excluded from the web dataset via URL matching. Details about each of the sources are provided below. ",
),
P(
"TxT360 respects the copyright of the data sources and have not included the controversial data that was used in The Pile like YouTube and Opensubtitles, Reddit threads, and book3."
),
)
treemap_data = {
"Source": [
"ArXiv",
"PubMed Central",
"PubMed Abstract",
"S2ORC Full Text",
"S2ORC Abstract",
"PhilPapers",
"Wikipedia",
"StackExchange",
"EuroParl",
"Ubuntu IRC",
"Freelaw",
"PG19",
"USPTO",
"HackerNews",
"DM Maths",
],
"Category": [
"Papers",
"Papers",
"Papers",
"Papers",
"Papers",
"Papers",
"Internet",
"Conversational",
"Legal/Formal",
"Conversational",
"Legal/Formal",
"Books",
"Legal/Formal",
"Conversational",
"Reasoning",
],
"Count": [100, 200, 150, 120, 80, 90, 199, 79, 6.1, 4.7, 71, 11, 45, 4.1, 22],
"Details": [
"A repository of scientific papers in various disciplines, including computer science, physics, mathematics, and more.",
"A database of biomedical and life sciences research articles.",
"Abstracts of biomedical literature from various sources.",
"Full-text articles from the Semantic Scholar Open Research Corpus.",
"Abstracts of articles from the Semantic Scholar Open Research Corpus.",
"Papers from the PhilPapers database, a comprehensive index and bibliography of philosophy research.",
"A collaborative online encyclopedia that covers a wide range of topics.",
"A network of question-and-answer websites on various subjects, including programming, science, mathematics, and more.",
"A collection of multilingual parallel corpora of parliamentary debates from the European Parliament.",
"Chat logs from the Ubuntu Internet Relay Chat (IRC) channels.",
"Legal documents and court cases from various jurisdictions.",
"A collection of books from Project Gutenberg, a digital library of public domain works.",
"Patent documents from the United States Patent and Trademark Office.",
"User-generated news and discussion platform focused on technology and startups.",
"Deep Mind Maths dataset with generated questions.",
],
}
total_count = sum(treemap_data["Count"])
treemap_data["Percentage"] = [
count / total_count * 100 for count in treemap_data["Count"]
]
fig = px.treemap(
treemap_data,
path=["Category", "Source"],
values="Count",
hover_data=["Details", "Percentage"],
hover_name="Source",
)
treemap_chart = fig
# start individual tables showing filterin
wikipedia_filter = pd.DataFrame(
{
"Dataset": [
"Wikipedia",
],
"Lines Downloaded": [
"61614907",
],
"Percent Removed After Language Filter": [
"0.00%",
],
"Percent Removed After Min Word Count Filter": [
"1.86%",
],
"Percent Removed After Unigram Probability Filter": [
"0.00%",
],
"Percent Removed After Local Dedup": [
"0.31%",
],
"Total Percentage Remaining": [
"97.84%",
],
}
)
table_html_wikipedia = wikipedia_filter.to_html(index=False, border=0)
table_div_wikipedia = Div(NotStr(table_html_wikipedia))
freelaw_filter = pd.DataFrame(
{
"Dataset": [
"FreeLaw",
],
"Lines Downloaded": [
"75971288",
],
"Percent Removed After Language Filter": [
"3.00%",
],
"Percent Removed After Min Word Count Filter": [
"7.49%",
],
"Percent Removed After Unigram Probability Filter": [
"0.07%",
],
"Percent Removed After Local Dedup": [
"82.73%",
],
"Total Percentage Remaining": [
"6.71%",
],
}
)
table_html_freelaw = freelaw_filter.to_html(index=False, border=0)
table_div_freelaw = Div(NotStr(table_html_freelaw))
dmm_filter = pd.DataFrame(
{
"Dataset": [
"DM Math",
],
"Lines Downloaded": [
"112559888",
],
"Percent Removed After Language Filter": [
"0.00%",
],
"Percent Removed After Min Word Count Filter": [
"0.00%",
],
"Percent Removed After Unigram Probability Filter": [
"0.00%",
],
"Percent Removed After Local Dedup": [
"0.00%",
],
"Total Percentage Remaining": [
"100.00%",
],
}
)
table_html_dmm = dmm_filter.to_html(index=False, border=0)
table_div_dmm = Div(NotStr(table_html_dmm))
uspto_filter = pd.DataFrame(
{
"Dataset": [
"USPTO",
],
"Lines Downloaded": [
"6880276",
],
"Percent Removed After Language Filter": [
"0.02%",
],
"Percent Removed After Min Word Count Filter": [
"1.88%",
],
"Percent Removed After Unigram Probability Filter": [
"0.01%",
],
"Percent Removed After Local Dedup": [
"22.94%",
],
"Total Percentage Remaining": [
"75.15%",
],
}
)
table_html_uspto = uspto_filter.to_html(index=False, border=0)
table_div_uspto = Div(NotStr(table_html_uspto))
pg19_filter = pd.DataFrame(
{
"Dataset": [
"PG-19",
],
"Lines Downloaded": [
"28752",
],
"Percent Removed After Language Filter": [
"0.24%",
],
"Percent Removed After Min Word Count Filter": [
"0.00%",
],
"Percent Removed After Unigram Probability Filter": [
"0.17%",
],
"Percent Removed After Local Dedup": [
"0.80%",
],
"Total Percentage Remaining": [
"98.78%",
],
}
)
table_html_pg19 = pg19_filter.to_html(index=False, border=0)
table_div_pg19 = Div(NotStr(table_html_pg19))
hn_filter = pd.DataFrame(
{
"Dataset": [
"HackerNews",
],
"Lines Downloaded": [
"2064931",
],
"Percent Removed After Language Filter": [
"2.62%",
],
"Percent Removed After Min Word Count Filter": [
"0.02%",
],
"Percent Removed After Unigram Probability Filter": [
"0.34%",
],
"Percent Removed After Local Dedup": [
"61.84%",
],
"Total Percentage Remaining": [
"35.18%",
],
}
)
table_html_hn = hn_filter.to_html(index=False, border=0)
table_div_hn = Div(NotStr(table_html_hn))
uirc_filter = pd.DataFrame(
{
"Dataset": [
"Ubuntu IRC",
],
"Lines Downloaded": [
"37966",
],
"Percent Removed After Language Filter": [
"0.00%",
],
"Percent Removed After Min Word Count Filter": [
"0.14%",
],
"Percent Removed After Unigram Probability Filter": [
"1.12%",
],
"Percent Removed After Local Dedup": [
"0.66%",
],
"Total Percentage Remaining": [
"98.08%",
],
}
)
table_html_uirc = uirc_filter.to_html(index=False, border=0)
table_div_uirc = Div(NotStr(table_html_uirc))
up_filter = pd.DataFrame(
{
"Dataset": [
"EuroParl",
],
"Lines Downloaded": [
"69814",
],
"Percent Removed After Language Filter": [
"0.00%",
],
"Percent Removed After Min Word Count Filter": [
"0.00%",
],
"Percent Removed After Unigram Probability Filter": [
"0.00%",
],
"Percent Removed After Local Dedup": [
"1.00%",
],
"Total Percentage Remaining": [
"99.00%",
],
}
)
table_html_up = up_filter.to_html(index=False, border=0)
table_div_up = Div(NotStr(table_html_up))
se_filter = pd.DataFrame(
{
"Dataset": [
"StackExchange",
],
"Lines Downloaded": [
"23246548",
],
"Percent Removed After Language Filter": [
"0.00%",
],
"Percent Removed After Min Word Count Filter": [
"0.00%",
],
"Percent Removed After Unigram Probability Filter": [
"0.00%",
],
"Percent Removed After Local Dedup": [
"0.00%",
],
"Total Percentage Remaining": [
"100.00%",
],
}
)
table_html_se = se_filter.to_html(index=False, border=0)
table_div_se = Div(NotStr(table_html_se))
arx_filter = pd.DataFrame(
{
"Dataset": [
"ArXiv",
],
"Lines Downloaded": [
"1911867",
],
"Percent Removed After Language Filter": [
"2.22%",
],
"Percent Removed After Min Word Count Filter": [
"5.65%",
],
"Percent Removed After Unigram Probability Filter": [
"0.07%",
],
"Percent Removed After Local Dedup": [
"0.00%",
],
"Total Percentage Remaining": [
"92.06%",
],
}
)
table_html_arx = arx_filter.to_html(index=False, border=0)
table_div_arx = Div(NotStr(table_html_arx))
s2o_filter = pd.DataFrame(
{
"Dataset": [
"S2ORC",
],
"Lines Downloaded": [
"12963563",
],
"Percent Removed After Language Filter": [
"0.00%",
],
"Percent Removed After Min Word Count Filter": [
"0.00%",
],
"Percent Removed After Unigram Probability Filter": [
"0.00%",
],
"Percent Removed After Local Dedup": [
"0.00%",
],
"Total Percentage Remaining": [
"100.00%",
],
}
)
table_html_s2o = s2o_filter.to_html(index=False, border=0)
table_div_s2o = Div(NotStr(table_html_s2o))
s2oa_filter = pd.DataFrame(
{
"Dataset": [
"S2ORC Abstract",
],
"Lines Downloaded": [
"102324176",
],
"Percent Removed After Language Filter": [
"18.04%",
],
"Percent Removed After Min Word Count Filter": [
"1.17%",
],
"Percent Removed After Unigram Probability Filter": [
"0.00%",
],
"Percent Removed After Local Dedup": [
"0.13%",
],
"Total Percentage Remaining": [
"80.66%",
],
}
)
table_html_s2oa = s2oa_filter.to_html(index=False, border=0)
table_div_s2oa = Div(NotStr(table_html_s2oa))
med_filter = pd.DataFrame(
{
"Dataset": [
"PubMed - Central",
],
"Lines Downloaded": [
"5230932",
],
"Percent Removed After Language Filter": [
"7.66%",
],
"Percent Removed After Min Word Count Filter": [
"1.29%",
],
"Percent Removed After Unigram Probability Filter": [
"0.02%",
],
"Percent Removed After Local Dedup": [
"0.00%",
],
"Total Percentage Remaining": [
"91.03%",
],
}
)
table_html_med = med_filter.to_html(index=False, border=0)
table_div_med = Div(NotStr(table_html_med))
pma_filter = pd.DataFrame(
{
"Dataset": [
"PubMed - Abstract",
],
"Lines Downloaded": [
"25787474",
],
"Percent Removed After Language Filter": [
"0.01%",
],
"Percent Removed After Min Word Count Filter": [
"0.14%",
],
"Percent Removed After Unigram Probability Filter": [
"0.00%",
],
"Percent Removed After Local Dedup": [
"0.00%",
],
"Total Percentage Remaining": [
"98.85%",
],
}
)
table_html_pma = pma_filter.to_html(index=False, border=0)
table_div_pma = Div(NotStr(table_html_pma))
phil_filter = pd.DataFrame(
{
"Dataset": [
"Phil Papers",
],
"Lines Downloaded": [
"49389",
],
"Percent Removed After Language Filter": [
"0.00%",
],
"Percent Removed After Min Word Count Filter": [
"0.00%",
],
"Percent Removed After Unigram Probability Filter": [
"0.12%",
],
"Percent Removed After Local Dedup": [
"0.00%",
],
"Total Percentage Remaining": [
"99.88%",
],
}
)
table_html_phil = phil_filter.to_html(index=False, border=0)
table_div_phil = Div(NotStr(table_html_phil))
## end individual tables showing filterin
## start filtered examples
wiki_examples = DV("data/curated_samples/wiki.json", 0, "Wikipedia")
freelaw_examples = DV2(
"data/curated_samples/freelaw_raw.json",
"data/curated_samples/freelaw_extract.json",
2,
)
se_examples = DV2(
"data/curated_samples/stackexchange_raw.json",
"data/curated_samples/stackexchange_extract.json",
3,
)
phil_examples = DV("data/curated_samples/philpapers_raw.json", 2, "PhilPapers")
arx_examples = DV2(
"data/curated_samples/arxiv_raw.json", "data/curated_samples/arxiv_markdown.json", 3
)
s2o_examples = DV("data/curated_samples/s2orc_raw.json", 0, "S2ORC")
s2oa_examples = DV("data/curated_samples/s2orc_abstract_raw.json", 0, "S2ORC Abstract")
pubmed_examples = DV2(
"data/curated_samples/pubmed_raw.json",
"data/curated_samples/pubmed_extract.json",
3,
)
dmm_examples = DV2(
"data/curated_samples/dm_maths_raw.json",
"data/curated_samples/dm_maths_extract.json",
3,
)
pg19_examples = DV("data/curated_samples/pg19_raw.json", 0, "PG19")
eu_examples = DV("data/curated_samples/europarl_raw.json", 0, "Europarl")
## end filtered examples
data_preprocessing_div = Div(
H2("Filtering Steps and Definitions"),
P(
"Data preprocessing is a crucial step in the data science pipeline. It involves cleaning and transforming raw data into a format that is suitable for analysis. This process includes handling missing values, normalizing data, encoding categorical variables, and more."
),
P(
"The ",
B("Language Filter"),
" removes documents in unwanted languages. This step improves data quality by removing irrelevant documents.",
),
P(
"The ",
B("Minimum Word Count Filter"),
" sets a threshold for required words within a document. This step filters out low-quality or incomplete documents. However, this step may remove documents that contain valuable information so a proper analysis is important for each data source.",
),
P(
"The ",
B("Unigram Log Probability Filter"),
" calculates the log probability of each unigram to measure the significance of individual words. This step quantifies the importance of individual words but may not capture the semantic meaning of words. To calculate the average log word probability, we use word frequencies extracted from the ",
A("1T Web-gram corpus", href="https://catalog.ldc.upenn.edu/LDC2006T13"),
". Specifically, we use the list available created by ",
A(
"Rachel Tatman",
href="https://www.kaggle.com/datasets/rtatman/english-word-frequency",
),
".",
),
H3("Data Processing for S2ORC"),
P(
"The formatting of the S2ORC dataset required special filters to be applied. These filters were not applied to the other data sources."
),
P(
"The ",
B("Title and Abstract Filter"),
" extracts information from the title and abstract. This step provides additional information for analysis but may introduce bias in the analysis.",
),
P(
"The ",
B("Majority Language Filter"),
" identifies the majority language in the dataset. This step displays the distribution of languages in the dataset to enable language-specific analysis and insights.",
),
P(
"The ",
B("Paragraph Count Filter"),
" counts the number of paragraphs in each document. This step helps to analyze the structure and length of documents which can be a useful heuristic for document complexity.",
),
P(
"The ",
B("Frequency Filter"),
" calculates the frequency of each word in the dataset. This step serves to identify important words and topics in the dataset but may be sensitive to noise and outliers.",
),
)
def diff2_stacked_bar():
# Data for the stacked bar chart
data = {
"Filter": [
"Downloaded Lines",
"Language Filter",
"Min Word Count",
"Unigram Log Probability",
],
"Wikipedia": [61614907, 61614907, 60468491, 60468491],
"Freelaw": [75971288, 73690766, 68171834, 68123174],
"DM Maths": [112559888, 112559888, 112559888, 112559888],
"USPTO": [6880276, 6878964, 6749922, 6749389],
"PG19": [28752, 28683, 28682, 28632],
"Hackernews": [2064931, 2010802, 2010488, 2003636],
"Ubuntu IRC": [37966, 23501, 23468, 23205],
"Europarl": [69814, 69814, 69814, 69814],
"StackExchange": [23246548, 23246548, 23246352, 23246352],
"Arxiv": [1911867, 1869441, 1763840, 1762661],
"S2ORC": [12963563, 12963563, 12963563, 12963563],
"S2ORC Abstract": [102324176, 83867601, 82889293, 82777912],
"Pubmed Central": [5230932, 4830486, 4768310, 4767474],
"Pubmed Abstract": [25787474, 25784374, 25747955, 25746724],
"Phil Papers": [49389, 39175, 39175, 39128],
}
df = pd.DataFrame(data)
fig = go.Figure()
for dataset in df.columns[1:]:
fig.add_trace(go.Bar(name=dataset, x=df["Filter"], y=df[dataset]))
fig.update_layout(
barmode="stack",
title="Document Reduction by Filter for Each Dataset",
xaxis_title="Filter",
yaxis_title="Number of Lines",
legend_title="Dataset",
height=600,
)
return fig
filtering_process = Div(
Section(
H2("Filtering Discussion on All Curated Sources"),
P(
"Below is a detail recount of how each dataset was extracted and filtered. If specific challenges were found with a dataset, they are included and discussed to the best of our abilities. The figure below provides a global view of the document filtering results. ~8% of documents were removed during these three steps."
),
plotly2fasthtml(diff2_stacked_bar()),
H3(
"This section continues below with the specific filtering steps taken for all 14 curated datasets."
),
),
Section(
Div(
H3("Wikipedia"),
P(
"Wikipedia is an encyclopedia form of high-quality text data used for language modeling. We have included filtered and deduplicated versions of complete Wikipedia data directly provided by the Wikipedia Foundation for more than 350 languages."
),
P(
B("Download and Extraction: "),
"The Wikimedia dataset was downloaded from the official snapshot on Huggingface: ",
A(
"https://huggingface.co/datasets/wikimedia/wikipedia/tree/main",
href="https://huggingface.co/datasets/wikimedia/wikipedia/tree/main",
),
". The",
D_code("huggingface dataset.to_json", language="python"),
" function was used to convert the original parquet format to the jsonl format.",
),
P(
B("Filtering: "),
"Manual inspection of the dataset demonstrated high quality content. Only one filter was used to remove articles with few words. Based normal sentence constructs, the article was kept if it contained 10 or more words. Any article with fewer than 10 words was removed.",
),
table_div_wikipedia,
Details(
Summary("Wikipedia Filtering Examples"),
Div(
wiki_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
Section(
Div(
H3("ArXiv"),
P(
"The ArXiv dataset is a vast collection of preprint research papers primarily in Mathematics, Computer Science, and Physics. Established in 1991, it offers high-quality text and mathematical knowledge, making it an invaluable resource for academic and scientific research. ArXiv papers are typically written in LaTeX, a popular typesetting system for these fields. We have extracted the information from latex and converted it into a text format."
),
P(
B("Download and Extraction: "),
"All the data was downloaded in original latex format from ArXiv official S3 repo: ",
A("s3://arxiv/src", href="s3://arxiv/src"),
". We aim to encode the downloaded data in UTF-8 format, and when necessary, utilize the chardet library to infer the appropriate encoding. After that, we use ",
A("Pandoc", href="https://pandoc.org/"),
" to extract information from the latex files into markdown format. The command we use is",
D_code(
"pandoc <raw_tex_path> -s -o <output_markdown_path> -f latex+raw_tex -t markdown_mmd [--lua-filter <lua_filter_path>]",
language="bash",
),
". Finally, all markdowns were combined to create jsonl files.",
),
P(B("Unique Data Preparation Challenges: ")),
P(
"When converting LaTeX files into Markdown using Pandoc, it is crucial to account for different data formats to minimize information loss while also filtering out noisy content in LaTeX. Below, we outline our considerations and methods for handling various data types during this conversion process:"
),
Ul(
Li(
B("Tables: "),
"The process for handling tables follows three main approaches. First, tables compatible with Pandoc’s built-in formats are directly converted into standard Markdown tables. Notably, LaTeX’s '\\multicolumn' and '\\multirow' commands can be successfully translated into valid Markdown tables. Second, tables unsupported by Pandoc’s native functionality, such as deluxetable or other complex LaTeX types, are preserved in their original LaTeX format to maintain the integrity of complex structures. Third, only a few remaining tables have been converted to HTML web tables.",
style="margin-bottom: -3px",
),
Li(
B("Mathematical Expressions: "),
"Inline mathematical expressions are rendered in Markdown. More complex equations remain unchanged, e.g., presented as '\\begin{aligned}' blocks, to ensure accuracy and readability.",
style="margin-bottom: -3px",
),
Li(
B("Figures: "),
"All figures are removed during the conversion process. Placeholder figures might not contribute to the paper’s data quality and, as such, have been omitted to streamline the output.",
style="margin-bottom: -3px",
),
Li(
B("Section Headers: "),
"Section headers are converted into markdown format, using leading '#' symbols to represent the heading levels.",
style="margin-bottom: -3px",
),
Li(
B("References: "),
"References are removed. Although they may be informative, references often introduce formatting inconsistencies or add little value compared to the core content of the paper.",
style="margin-bottom: -3px",
),
),
P(
B(" Filters Applied: "),
"multiple filters are used here after manually verifying output of all the filters as suggested by peS2o dataset",
D_cite(bibtex_key="peS2o"),
),
Ul(
Li(
"Language Filter: any language other than English are discarded",
style="margin-bottom: -3px",
),
Li(
"Minimum Word Count Filter: less than 500 words (not inclusive) are discarded",
style="margin-bottom: -3px",
),
Li(
"Unigram Log Probability Filter Threshold: -20",
style="margin-bottom: -3px",
),
Li(
"Note: the Frequency Filter was calculated but not applied. The most frequent word in the paper consists of alpha characters only, and it appears in less than 7.5% of the document. Words are obtained by splitting the text on whitespace.",
style="margin-bottom: -3px",
),
),
table_div_arx,
Details(
Summary("ArXiv Filtering Examples"),
Div(
arx_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
Section(
Div(
H3("S2ORC"),
P(
"The Semantic Scholar Open Research Corpus (S2ORC) is a comprehensive dataset designed for natural language processing (NLP) and text-mining research over scientific papers. It includes rich metadata, and abstract and full-text content for millions of academic papers across various disciplines. This dataset is further divided into two components, S2ORC abstract and S2ORC full text."
),
H4(""),
P(
B("Download and Extraction: "),
"S2ORC was downloaded directly in zip format using S2ORC api key and a get() request: ",
D_code("response = urllib.request.urlopen(url)", language="python"),
),
P(
B("Filters Applied: "),
"Multiple filters are used here after manually verifying output of all the filters as suggested by peS2o dataset",
),
Ul(
Li(
"Title and Abstract Filter: must have title and abstract",
style="margin-bottom: -3px",
),
Li(
"Language Filter: The paper must be in English. To determine the language of each document, we use the pycld3 library. We run pycld3 on the first 2000 characters of each paragraph in the paper. The language of the paper is the most common language of the paragraphs.",
style="margin-bottom: -3px",
),
Li(
"Word Count Filter: less than 500 words (not inclusive) are discarded",
style="margin-bottom: -3px",
),
Li(
"Paragraph Count Filter: The paper must have at least 5 paragraphs after removing paragraphs with less than -20 average log word probability",
style="margin-bottom: -3px",
),
Li(
"Frequency Filter: The most frequent word in the paper consists of alpha characters only, and it appears in less than 7.5% of the document. Words are obtained by splitting the text on whitespace.",
style="margin-bottom: -3px",
),
),
table_div_s2o,
# Details(
# Summary("S2ORC Filtering Examples -- need to update"),
# Div(
# P("examples are missing"),
# style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
# ),
# style="""
# background-color: #FFFAEA; /* Light yellow background */
# padding: 15px;
# border-radius: 12px;
# margin-bottom: 15px
# """,
# ),
),
),
Section(
Div(
H3("S2ORC Abstract"),
P(
"The Semantic Scholar Open Research Corpus (S2ORC) is a comprehensive dataset designed for natural language processing (NLP) and text-mining research over scientific papers. It includes rich metadata, and abstract and full-text content for millions of academic papers across various disciplines. This dataset is further divided into two components, S2ORC abstract and S2ORC full text."
),
P(
B("Download and Extraction: "),
"S2ORC was downloaded directly in zip format using S2ORC api key and a get() request: ",
D_code("response = urllib.request.urlopen(url)", language="python"),
),
P(
B("Filters Applied: "),
"multiple filters are used here after manually verifying output of all the filters as suggested by peS2o dataset. The frequency filter was not used as suggested by peS2o because it was removing good samples as inspected manually",
),
Ul(
Li(
"Title and Abstract Filter: must have title and abstract",
style="margin-bottom: -3px",
),
Li(
"Majority Language Filter: abstract must be in English",
style="margin-bottom: -3px",
),
Li(
"Minimum Word Count Filter: less than 20 (not inclusive) are discarded",
style="margin-bottom: -3px",
),
Li(
"Unigram Log Probability Threshold: -20",
style="margin-bottom: -3px",
),
Li(
"Note: Frequency Filter: The most frequent word in the paper consists of alpha characters only, and it appears in less than 7.5% of the document. Words are obtained by splitting the text on whitespace.",
style="margin-bottom: -3px",
),
),
table_div_s2oa,
# Details(
# Summary("S2ORC Abstract Filtering Examples "),
# Div(
# P("examples are missing"),
# style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
# ),
# style="""
# background-color: #FFFAEA; /* Light yellow background */
# padding: 15px;
# border-radius: 12px;
# margin-bottom: 15px
# """,
# ),
)
),
Section(
Div(
H3("PubMed Central and PubMed Abstract"),
P(
B("Download and Extraction: "),
"All files were downloaded from",
A(
"ttps://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_package/",
href="ttps://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_package/",
),
". PubMed Central (PMC) files are downloaded in an xml.tar format. The tar files are opened and converted to markdown format using pandoc",
D_code(
"pandoc <raw_xml_path> -s -o <output_markdown_path> -f jats -t markdown_mmd [--lua-filter <lua_filter_path>]",
language="bash",
),
". The markdown files are combined to create jsonl files. PubMed Abstract (PMA) files were downloaded in xml. The BeautifulSoup library was used to extract the abstract, title, and PMID. All files were stored in jsonl format.",
),
P(B("Unique Data Preparation Challenges: ")),
Ul(
Li(
"We tried similar attempts on PMC as we did on ArXiv. The resulted markdown might have slight difference due to the different structure of the XML files.",
style="margin-bottom: -3px",
),
),
P(
B("Filters Applied: "),
"Multiple filters are used here after manually verifying output of all the filters as suggested by peS2o dataset.",
),
Ul(
Li(
"Minimum Word Count Filter: PMC documents with less than 100 words (not inclusive) are discarded; PMA documents less than 20 words are discarded",
style="margin-bottom: -3px",
),
Li("Language Filter: English only", style="margin-bottom: -3px"),
Li(
"Frequency Filter: The most frequent word in the paper consists of alpha characters only, and it appears in less than 7.5% of the document. Words are obtained by splitting the text on whitespace. This filter was not used for PMA",
style="margin-bottom: -3px",
),
Li(
"Unigram Log Probability Threshold: -20",
style="margin-bottom: -3px",
),
),
table_div_med,
table_div_pma,
Details(
Summary("PubMed Filtering Examples"),
Div(
pubmed_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
Section(
Div(
H3("Phil Papers"),
P(
"Papers from the PhilPapers database, a comprehensive index and bibliography of philosophy research maintained by the Center for Digital Philosophy at the University of Western Ontario."
),
P(
B("Download and Extraction: "),
"Original PDF files download from ",
A(
"https://philarchive.org/oai.pl",
href="https://philarchive.org/oai.pl",
),
". All available PDF's were downloaded. Each PDF was converted to text using java",
D_code(
"-jar ../philpapers_resources/src/pdfbox-app-2.0.21.jar ExtractText {f0} {FOUT.name}",
language="python",
),
". After converting to text formatting, a language was detected and added using the langdetect (citation needed) library.",
),
P(B("Filters Applied: ")),
Ul(
Li(
P(
"Hyphenation Removal:",
D_code("end-of", language="python"),
" becomes ",
D_code("end of", language="python"),
),
style="margin-bottom: -3px",
),
Li(
P(
"Newline Filtering:",
D_code("This is/na sentence.", language="python"),
" becomes ",
D_code("This is a sentence.", language="python"),
),
style="margin-bottom: -3px",
),
Li(
P(
"Header/Footer Filtering:",
D_code("(c) 2023 Company Name.", language="python"),
" is removed ",
),
style="margin-bottom: -3px",
),
Li(
P(
"Double Whitespace Filtering:",
D_code("This is a test.", language="python"),
" becomes ",
D_code("This is a test.", language="python"),
),
style="margin-bottom: -3px",
),
Li(
P(
"Mean Line Length Check: ",
"removes paragraphs with an average line length of < 2.0",
),
style="margin-bottom: -3px",
),
Li(
P(
"CID Percentage Filter: ",
"removes LaTex heavy paragraphs that contain over 10% “CID” font artifacts.",
),
style="margin-bottom: -3px",
),
Li(
P(
"Letterness Filter: ",
"discards paragraphs with a low proportion of letters",
),
style="margin-bottom: -3px",
),
Li(
P(
"Removing Leading/Trailing Numbers: ",
"removes numbers at the start or end of paragraphs. ",
D_code("1 This is a sentence.", language="python"),
" becomes ",
D_code("This is a sentence.", language="python"),
),
style="margin-bottom: -3px",
),
Li(
P("Fixing Unicode Issues: ", "fixes Unicode issues."),
style="margin-bottom: -3px",
),
Li(
P(
"Combining Diacritics Correction: ",
D_code("a'", language="python"),
" becomes ",
D_code("å", language="python"),
),
style="margin-bottom: -3px",
),
Li(
P(
"Unigram Log Probability: ",
"the document must have higher than -20 average unigram log probability.",
),
style="margin-bottom: -3px",
),
),
table_div_phil,
Details(
Summary("Phil Papers Filtering Examples"),
Div(
phil_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
Section(
Div(
H3("EuroParl"),
P(
"A collection of multilingual parallel corpora of parliamentary debates from the European Parliament. This is a high-quality legacy dataset earlier used for translation tasks."
),
P(
B("Download and Extraction: "),
"Original dataset was downloaded from ",
A(
"http://www.statmt.org/europarl/v7/europarl.tgz",
href="http://www.statmt.org/europarl/v7/europarl.tgz",
),
". The files were converted to jsonl lines for filtering.",
),
P(
B("Filters Applied: "),
"EuroParl was initially filtered during the download process. Documents with fewer than 200 characters were removed. The documents also contained HTML tags which were removed.",
),
D_code(
"""
Raw single line in data: <P> Hi I am speaker
After tag removal: P Hi I am speaker
We remove everything that starts with ["P", "BRK", "CHAPTER", "/P"]
and only keep tagname == SPEAKER
because line starting with <SPEAKER> TEXT TEXT ....... has the relevant text
""",
style="block",
language="python",
),
D_code(
"""
def process_tag(original_tag):
tag = original_tag.strip(">").strip("<")
# Skip empty tags
if not tag:
return None
tagname = tag.split()[0]
# Skip paragraph, break, and chapter tags
if tagname in ["P", "BRK", "CHAPTER", "/P"]:
return None
# For speaker tags, return the name
if tagname == "SPEAKER":
soup = bs4.BeautifulSoup(original_tag, "html.parser")
name = soup.speaker["name"]
return name
# Raise a error here if there is a tag we don't know
raise ValueError(f"Unknown tag {tag}")
""",
style="block",
language="python",
),
table_div_up,
Details(
Summary("EuroParl Filtering Examples"),
Div(
eu_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
Section(
Div(
H3("HackerNews"),
P(
"A dialog-based dataset where user comments on the links as the head post aggregated by Y Combinator."
),
P(
B("Download and Extraction: "),
"The dataset was downloaded from the HackerNews repo here: ",
A(
"https://hacker-news.firebaseio.com/v0/item/",
href="https://hacker-news.firebaseio.com/v0/item/",
),
". The dataset was parsed using the Story ID. In this dataset each post is a story, and each reply is considered subsequent story. Story IDs were considered between ID 1 to 37500000. The URL for all Story IDs was pinged. If that ID returned an error, the ID was removed. Each request was given a 2 second wait to account for network time.",
),
P(
"The HackerNews dataset contains a vast amount of stories and is known for lively discussions. Due to the number of replies a story may contain, only longest comment thread for each story was sampled past level 3. All stories included the title (1st level) and all direct replies (2nd level). We may consider relax this constrain and extract more data."
),
P(B("Unique Data Preparation Challenges: ")),
Ul(
Li(
"The converesation and forum style structure can be a very helpful signal for language model training. During processing the dataset, we try to encode such structure but without introducing too much noise. We choose to use an",
D_code("<AUTHOR>", language="html"),
" tag to encode the main thread text by the original poster, and use a ",
D_code("<COMMENT>", language="html"),
" tag to encode the replies. We initially choose ",
D_code("<P>", language="html"),
" as a tag since it is used by some instruction tuning dataset, but realize the ",
D_code("<P>", language="html"),
" tag can easily conflict with the original text.",
style="margin-bottom: -3px",
),
Li(
"As discussed above, the comment hierarchies required a thoughtful approach to extracting meaningful data. ",
style="margin-bottom: -3px",
),
Li(
"In the comment thread heirarchy, relationships had to be assigned to between the comments, sub-comments, and original story ID. ",
style="margin-bottom: -3px",
),
),
P(B("Filters Applied: ")),
Ul(
Li("Language Filter: English", style="margin-bottom: -3px"),
Li("Minimum Word Count Filter: 10", style="margin-bottom: -3px"),
Li(
"Unigram Log Probability Threshold: -20",
style="margin-bottom: -3px",
),
),
table_div_hn,
),
),
Section(
Div(
H3("USPTO"),
P("Patent documents from the United States Patent and Trademark Office."),
P(
B("Download and Extraction: "),
"Data was downloaded and extracted using tags from ",
A(
"https://bulkdata.uspto.gov/data/patent/grant/redbook/fulltext/",
href="https://bulkdata.uspto.gov/data/patent/grant/redbook/fulltext/",
),
". There were three different formats that needed three different functions to download and extract the data based on year:",
I("Pre_2002"),
", ",
I("2002_to_2004"),
" and",
I("post_2004"),
". We used the exact code used in The Pile (citation needed).",
),
P(B("Filters Applied: ")),
Ul(
Li("Language Filter: English", style="margin-bottom: -3px"),
Li("Minimum Word Count Filter: 50", style="margin-bottom: -3px"),
Li("Unigram Log Probability", style="margin-bottom: -3px"),
),
table_div_uspto,
),
),
Section(
Div(
H3("FreeLaw"),
P(
"Legal documents and court cases from various jurisdictions provided by US-registered non-profit firm Free Law Project. We have included data from CourtListener which included millions of legal opinions from federal and state courts."
),
P(
B("Download and Extraction"),
"The dataset was downloaded from: ",
A(
"https://storage.courtlistener.com/bulk-data/",
href="https://storage.courtlistener.com/bulk-data/",
),
". There are 19 CSV files which contain overlapping content. CSV files can contain content in multiple columns requiring a holistic extraction approach. Text was extracted from the following using html2text function. The block below shows how each text type was extracted.",
),
D_code(
"""
("html", html2text), ("html_lawbox", html2text),
("html_columbia", html2text), ("html_anon_2020", html2text),
("html_with_citations", html2text), ("xml_harvard", html2text),
plain_text
""",
language="python",
),
P(
"All content was downloaded leading to high number of documents filtered during local deduplication. Following The Pile, priority was given to plain_text first, followed by the columns in the table in reverse order."
),
P(B("Unique Data Preparation Challenges: ")),
P(
"The Freelaw text uses a lot of whitespaces and newlines to format the document visually. These lines are not necessary for language model learning and sometimes have confusing semantic meanings. We attempt to unify how whitespaces appear in this dataset with the following heuristics."
),
Ul(
Li(
"Consecutive whitespaces and tabs were found. Consecutive Whitespaces and tabes were reduce to one, single whitespace.",
style="margin-bottom: -3px",
),
Li(
"Whitespaces were found between new lines with no addition text. These whitespaces were removed.",
style="margin-bottom: -3px",
),
Li(
"Consecutive new lines were found in some documents without leading to a new paragraph. All consecutive newline to a single new line.",
style="margin-bottom: -3px",
),
Li(
"Converted all single new lines to whitespace. If whitespace was found after a new line with no text, the whitespace was removed. All leading and trailing whitespace was removed.",
style="margin-bottom: -3px",
),
Li(
"All form feed (",
D_code("\\f", language="bash"),
")characters were removed.",
style="margin-bottom: -3px",
),
),
P(B("Filters Applied: ")),
Ul(
Li("Language Filter: English", style="margin-bottom: -3px"),
Li("Minimum Word Count Filter: 50", style="margin-bottom: -3px"),
Li("Unigram Log Probability", style="margin-bottom: -3px"),
),
P(
"Note: Local deduplication within FreeLaw itself removed 90%+ of the dataset as duplicate."
),
table_div_freelaw,
Details(
Summary("FreeLaw Filtering Examples"),
Div(
freelaw_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
Section(
Div(
H3("StackExchange"),
P(
"A network of question-and-answer websites on various subjects, including programming, science, mathematics, and more. This is one of the largest publicly available repositories for question-answer pairs. We have included comments also to include an overall discussion on each post."
),
P(
B("Download and Extraction: "),
"The archive dataset was used to download all data from StackExchange and 364 StackExchange's sub URLs including: ",
A("math.stackexchange.com", href="math.stackexchange.com"),
". Raw data was extracted an XML format and only two files Posts.xml and Comments.xml were considered. To match the StackExchange hierarchy, each file was parsed using post_id to connect questions to answers and then to comments. We will include the full list of sub URLs in when the code is released.",
),
D_code(
"""
1. Questions:
2. Comment1:
3. Comment2:
4. Answer1:
5. Comment1:
6. Comment2:
7. Answer2:
8. Comment1:
9. Comment2:""",
block="block",
language="python",
),
P(B("Unique Data Preparation Challenges: ")),
Ul(
Li(
"Handling code block was a required finding the specific blocks and extracting the details in one snippet.",
style="margin-bottom: -3px",
),
Li(
"Question and Answer formatting had to be rewritten to match the question and the anwer.",
style="margin-bottom: -3px",
),
Li(
"Occasionally a title was not included at the beginning of a question. For consistent formatting, a title was added.",
style="margin-bottom: -3px",
),
),
P(B("Filters Applied: ")),
Ul(
Li("Minimum Word Count Filter: 10", style="margin-bottom: -3px"),
),
table_div_se,
Details(
Summary("StackExchange Filtering Examples"),
Div(
se_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
Section(
Div(
H3("Ubuntu IRC"),
P(
"Chat logs from the Ubuntu Internet Relay Chat (IRC) channels on the Freenode IRC chat server. This data is also another form of dialog dataset on niche topics."
),
P(
B("Download and Extraction: "),
"The dataset was downloaded from: ",
A(
"https://irclogs.ubuntu.com/{date.year}/{date.month:02d}/{date.day:02d}/",
href="https://irclogs.ubuntu.com/{date.year}/{date.month:02d}/{date.day:02d}/",
),
" based on the year.",
),
P("During extraction, the logs were cleaned using following functions:"),
D_code(
"""
def exclude_system(x):
return '\n'.join(line for line in x.split('\n') if not line.startswith('==='))
def exclude_select_system(x):
return '\n'.join(line for line in x.split('\n') if not (line.startswith('===')
and any(term in line for term in
['has joined #', 'has left #', 'Topic for #', "Topic (#", "is now known as"]) ))
def clean(x):
return '\n'.join('* ' + line[4:] if line.startswith('===') else line[8:] for line in x.split('\n'))
""",
block="block",
language="python",
),
P(B("Unique Data Preparation Challenges: ")),
Ul(
Li(
"Similar to the HackerNews challenges, we had to map comments and sub-comments to the original question.",
style="margin-bottom: -3px",
),
Li(
"The dataset comes with the usernames of post authors. We attempt to replace them with strings such as <USER1> to remove the PII. This step might also reduce the language model's effort to memorizing the user names."
),
),
P(B("Filters Applied: ")),
Ul(
Li("Language Filter: English", style="margin-bottom: -3px"),
Li("Minimum Word Count Filter: 10", style="margin-bottom: -3px"),
Li("Unigram Log Probability", style="margin-bottom: -3px"),
),
table_div_uirc,
),
),
Section(
Div(
H3("DM Math"),
P(
"DeepMind Math dataset with generated questions from various topics like algebra, calculus, geometry, etc. Maths data is included to improve model reasoning abilities in the downstream tasks."
),
P(
B("Download and Extraction: "),
"The dataset was downloaded directly from the Huggingface repo: ",
A(
"https://huggingface.co/datasets/deepmind/math_dataset",
href="https://huggingface.co/datasets/deepmind/math_dataset",
),
". The data was converted to the jsonl format where lines is represented as:",
),
D_code(
"""
Question: TEXT
Answer: TEXT""",
block="block",
language="python",
),
P(B("Unique Data Preparation Challenges: ")),
Ul(
Li(
"In one of our versions, we save the string as a byte string instead of raw text, introducing addition byte indicators at the string level",
style="margin-bottom: -3px",
),
Li('No space before keyword "Answer:"', style="margin-bottom: -3px"),
),
P(B("Filters Applied: ")),
Ul(
Li("No filtering was applied to DM Math", style="margin-bottom: -3px"),
),
table_div_dmm,
Details(
Summary("DM Math Filtering Examples"),
Div(
dmm_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
Section(
Div(
H3("PG-19"),
P(
"A collection of books from Project Gutenberg, a digital library of public domain works. This contains all the books that were published before 1919."
),
P(
B("Download and Extraction: "),
"The dataset was downloaded directly from Huggingface: ",
A(
"https://huggingface.co/datasets/deepmind/pg19",
href="https://huggingface.co/datasets/deepmind/pg19",
),
".",
),
P(B("Unique Data Preparation Challenges: ")),
Ul(
Li(
"The original books uses a lot of witespaces to format the text, similar to the case of FreeLaw. Sometimes, 10+ consecutive whitespaces were found. These whitespaces were reduce to one, single whitespace.",
style="margin-bottom: -3px",
),
Li(
"For similar reasons, consecutive new lines were found in some documents. All consecutive news over two were were reduce to two new lines.",
style="margin-bottom: -3px",
),
Li(
"The books are formmated with end-of-line hyphenation and break a single words into two lines. Hence a regular word such as ",
D_code("text", language="bash"),
" could become ",
D_code("te-\\nxt", language="bash"),
". We detect the combination of ",
D_code("-\\n", language="bash"),
" and remove them to the origin word heuristically.",
style="margin-bottom: -3px",
),
Li(
"Text delimiters such as * * * * * * * * were used to indicate structures like sections. We removed such known delimiters and replaced them with proper whitespaces and new lines. For others, we make sure there are no additional leading or trailing whitepsaces.",
style="margin-bottom: -3px",
),
),
P(B("Filters Applied:")),
Ul(
Li("Language Filter: English", style="margin-bottom: -3px"),
Li("Minimum Word Count Filter: 20", style="margin-bottom: -3px"),
Li("Unigram Log Probability: ", "-20", style="margin-bottom: -3px"),
),
table_div_pg19,
Details(
Summary("PG-19 Filtering Examples"),
Div(
pg19_examples,
style="background-color: white; padding: 15px; margin-top: 10px; margin-bottom: 10px; border-radius: 8px; border: none; ", # Styling for the DV2 part
),
style="""
background-color: #FFFAEA; /* Light yellow background */
padding: 15px;
border-radius: 12px;
margin-bottom: 15px
""",
),
),
),
)
local_dedup_text = P(
"Each curated data source has been prepared using its specific rules and has been locally deduped using min-hash near deduplication. Details about the dataset are shown below in the table:"
)
data_pipeline_table = pd.DataFrame(
{
"Data Source": [
"Papers",
"Wikipedia",
"StackExchange",
"Europarl",
"Ubuntu IRC",
"HackerNews",
"PG-19",
"USPTO",
"Freelaw",
"DM Math",
],
"Percent Filtered": [
"15%",
"21%",
"<0.1%",
"1%",
"0.4%",
"60%",
"0.8%",
"22.5%",
"94%",
"0",
],
"Unique Document Percentage": [
"75.99%",
"91.91%",
"98.02%",
"98.87%",
"100%",
"99.91%",
"31.81%",
"99.94%",
"91.01%",
"0",
],
"2 - 5 Duplicates": [
"19.4%",
"4.7%",
"1.27%",
"0.94%",
"0",
"0.05%",
"20.03%",
"0.05%",
"6,87%",
"0",
],
"6 - 10 Duplicates": [
"2.89%",
"1.58%",
"0.35%",
"0.09%",
"0",
"0.02%",
"24.27%",
"0.01%",
"1.07%",
"0",
],
"11 - 100 Duplicates": [
"1.17%",
"1.76%",
"0.35%",
"0.1",
"0",
"0.02%",
"22.26%",
"0.01%",
"1.05%",
"0",
],
"101 - 1000 Duplicates": [
"0.01%",
"0.05%",
"0.01%",
"0",
"0",
"<0.01%",
"1.58%",
"<0.01%",
"0.01%",
"0",
],
"1001+ Duplicates": [
"<0.01%",
"<0.01%",
"<0.01%",
"0",
"0",
"<0.01%",
"0.06%",
"0",
"0",
"0",
],
}
)
table_html_data_pipe = data_pipeline_table.to_html(index=False, border=0)
table_div_data_pipe = Div(NotStr(table_html_data_pipe), style="margin: 40px;")
def curated():
data_preparation_steps = pd.DataFrame(
{
"Method": [
"HTTP/FTP dumps",
"Web crawling",
"Archive snapshot",
"Generated",
"Curated",
],
"Description": [
"Acquiring data from HTTP/FTP dumps",
"Crawling websites to extract data",
"Working with archive dumps",
"Generating synthetic data",
"High quality curated data",
],
"Source": [
"Freelaw | Wikipedia | PhilPapers | Arxiv | S2ORC | Pubmeds",
"USPTO | Hackernews | Ubuntu IRC",
"StackExchange",
"DM Maths",
"PG19 | Europarl",
],
}
)
table_html = data_preparation_steps.to_html(index=False, border=0)
table_div = Div(NotStr(table_html), style="margin: 40px;")
text = P(
"""This initial stage serves as the foundation for the entire
process. Here, we focus on acquiring and extracting the raw data, which can
come from various sources such as crawling websites, using HTTP/FTP dumps,
or working with archive dumps. For instance, to download and prepare a
dataset, we can specific downloaders based on the data source. Each dataset
might have its own downloader script which can be updated in real time to
handle changes in the data source. Here is a general outline of the data
preparation process: It is worth noting that some pipelines might require
invoking additional functions or scripts to handle specific data sources or
formats. These helper scripts can be located within specific directories
or modules dedicated to the dataset."""
)
return Div(
Section(
overview,
id="section31",
),
Section(
curated_sources_intro,
plotly2fasthtml(treemap_chart),
# id="section31",
),
Section(
data_preprocessing_div,
id="section32",
),
Section(
filtering_process,
id="section33",
),
id="inner-text",
)