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-web 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", ), ), ), ) curated_sources_intro = Div( H2("Curated Sources in TxT360"), P( "Curated sources comprise high-quality datasets that contain domain-specificity.", B( " TxT360 was strongly influenced by The Pile", D_cite(bibtex_key="thepile"), " regarding both inclusion of the dataset and filtering techniques." ), " These sources, such as Arxiv, Wikipedia, and Stack Exchange, provide valuable data that is excluded from the web dataset mentioned above. Analyzing and processing non-web data can yield insights and opportunities for various applications. 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 books." ), ) 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, 300, 250, 180, 150, 150, 250, 180, 120, 90], "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": [ "", ], "Total Percentage Remaining": [ "", ], } ) table_html_wikipedia = wikipedia_filter.to_html(index=False, border=0) table_div_wikipedia = Div(NotStr(table_html_wikipedia), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_freelaw = freelaw_filter.to_html(index=False, border=0) table_div_freelaw = Div(NotStr(table_html_freelaw), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_dmm = dmm_filter.to_html(index=False, border=0) table_div_dmm = Div(NotStr(table_html_dmm), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_uspto = uspto_filter.to_html(index=False, border=0) table_div_uspto = Div(NotStr(table_html_uspto), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_pg19 = pg19_filter.to_html(index=False, border=0) table_div_pg19 = Div(NotStr(table_html_pg19), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_hn = hn_filter.to_html(index=False, border=0) table_div_hn = Div(NotStr(table_html_hn), style="margin: 40px;") uirc_filter = pd.DataFrame( { "Dataset": [ "Ubunutu IRC", ], "Lines Downloaded": [ "37966", ], "Percent Removed After Language Filter": [ "38.10%", ], "Percent Removed After Min Word Count Filter": [ "0.14%", ], "Percent Removed After Unigram Probability Filter": [ "1.12%", ], "Percent Removed After Local Dedup": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_uirc = uirc_filter.to_html(index=False, border=0) table_div_uirc = Div(NotStr(table_html_uirc), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_up = up_filter.to_html(index=False, border=0) table_div_up = Div(NotStr(table_html_up), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_se = se_filter.to_html(index=False, border=0) table_div_se = Div(NotStr(table_html_se), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_arx = arx_filter.to_html(index=False, border=0) table_div_arx = Div(NotStr(table_html_arx), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_s2o = s2o_filter.to_html(index=False, border=0) table_div_s2o = Div(NotStr(table_html_s2o), style="margin: 40px;") 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": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_med = med_filter.to_html(index=False, border=0) table_div_med = Div(NotStr(table_html_med), style="margin: 40px;") phil_filter = pd.DataFrame( { "Dataset": [ "Phil Papers", ], "Lines Downloaded": [ "49389", ], "Percent Removed After Language Filter": [ "20.68%", ], "Percent Removed After Min Word Count Filter": [ "0.00%", ], "Percent Removed After Unigram Probability Filter": [ "0.12%", ], "Percent Removed After Local Dedup": [ "", ], "Total Percentage Remaining": [ "%", ], } ) table_html_phil = phil_filter.to_html(index=False, border=0) table_div_phil = Div(NotStr(table_html_phil), style="margin: 40px;") ## 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_extract.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 maay 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 formating 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.", ), ) # 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], } # Creating a dataframe df = pd.DataFrame(data) # Creating the stacked bar chart fig = go.Figure() # Add trace for each dataset for dataset in df.columns[1:]: fig.add_trace(go.Bar(name=dataset, x=df["Filter"], y=df[dataset])) # Update the layout 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, width=1000, ) # Show the plot diff2_stacked_bar = 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 belows 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 parqet 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://arxic/src", href="s3://arxic/src"), ". We try to encode the downloaded data into utf-8 or guess encoding using chardet library. After that pandoc was used to extract information from the latex files and saved as markdown format", D_code( "pandoc -s {tex} -o out/{out_name}.md --wrap=none", language="python", ), ". All markdowns were combined to create jsonl files.", ), P(B("Unique Data Preparation Challenges: ")), Ul( Li( "Due to large amounts of meaningful data being contained in table formats, special consideration was taken to extract the data and proper metadata.", 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 world 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", ), ), 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 -f jats {nxml} -o {pmcid}.md", 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( "Due to large amounts of meaningful data being contained in table formats, speical consideration was taken to extract the data and proper metadata.", 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, 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:
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 tagnae == SPEAKER
because line starting with