SlideShare a Scribd company logo
1 of 1
Download to read offline
Text::Perfide::BookCleaner,
                                           a Perl module to clean and normalize plain text books
                                                                                           Andr´ Santos, Jos´ Jo˜o Almeida
                                                                                               e            e a

                                                                                                                                     Table 2: Example excerpt before and after processed with sections
 Abstract                                                                                                    1 PRIMEIRA PARTE
                                                                                                                                                                         1 _sec+N:part=1_ PRIMEIRA PARTE
   Several tasks which include text documents processing, such as text alignment, format                     2
                                                                                                                                                                         2
                                                                                                             3 FANTINE
 conversions or information retrieval are heavily affected by the state of the original docu-                 4
                                                                                                                                                                         3 FANTINE
                                                                                                                                                                         4
 ments.                                                                                                      5
                                                                                                                                                                         5 _sec+N:book=1_ LIVRO PRIMEIRO
                                                                                                             6   ^L LIVRO PRIMEIRO
   Text::Perfide::BookCleaner is a Perl module to pre-process plain text books and                                                                                       6
                                                                                                             7                                                       ⇒7      UM JUSTO
 clean them, getting them prepared for further arbitrary use.                                                8 UM JUSTO
                                                                                                                                                                         8
   Cleaning tasks include removing page breaks, page numbers, headers and footers; find-                      9
                                                                                                                                                                         9 O abade Myriel
                                                                                                            10 O abade Myriel
 ing section titles and boundaries; removing footnotes and normalizing paragraph notation                   11
                                                                                                                                                                        10
                                                                                                                                                                        11 Em 1815, era bispo de Digne, o
 and Unicode characters. The process is guided with the help of declarative objects such as                 12 Em 1815, era bispo de Digne, o
                                                                                                                                                                        12 reverendo Carlos Francisco Bemvindo
                                                                                                            13 reverendo Carlos Francisco Bemvindo
 ontologies and configuration files.

                                                                                                            2.3        Paragraphs
1        Motivation                                                                                           Several possible notations for paragraphs:
 Text processing (and particularly book alignment) are tasks whose perfor-                                  new-line separated, blank-line separated,                        Algorithm
mance is often negatively affected by:                                                                       indented or not. Direct speech can also be                       Function paragraphs(text){
                                                                                                                                                                               Calculate text’s word and
                                                                                                            delimited with quotation marks or preceded
                                                                                                                                                                                 line metrics
        • Page structure                                        • Paragraphs                                with a dash.                                                       Find paragraph notation
        • Section titles and boundaries                         • Character encoding etc.                     Some metrics based on the number of                              Normalize paragraph notation
        • Footnotes                                                                                         words, white spaces, empty and non-empty                         }
                                                                                                            lines can be used to infer the type of no-
                                                                                                            tation used, which can then be normalized.
2        Book cleaner
                                                                                                            2.4        Footnotes
                                                                                                              Footnotes are formed by a call mark in the
                                                                                                            middle of the text, and the matching foot-                       Algorithm
                                                                                                            note expansion, which generally appears at                       Function footnotes(text)
                                                                                                                                                                               lines = lines from text
                                                                                                            the end of the same page.
                                                                                                                                                                               fnpattern = <<int>>, [int], ^int, ...
                                                                                                              Footnote expansions can often be found                           for ( x ∈ dom(lines)
                                                                                                            at the bottom of the page or, sometimes, at                              : x begins with fnpattern
                                                                                                            the end of the document.                                                 ∧ x is immediately before or
                                                                                                                                                                                         after page break ){
                                                                                                              Footnote call marks appear in the middle                           Replace x in text with custom mark
                                                                                                            of the text, usually consisting of some kind                         Add x to standoff file
                                                                                                            of numeration highlighted by some special                          }
                                                                                                            symbol.                                                            for ( y ∈ text : y ∈ fnpattern ){
                                                                                                                                                                                 Replace y in text with custom mark
                                                                                                                                                                                 Add y to standoff file
                                                                                                                                                                               }
                                                                                                                                                                             }

                                                                                                                                     Table 3: Example excerpt before and after processed with footnotes

                                                                                                             1   aupr`s de la rue Saint-Antoine,
                                                                                                                     e
2.1         Pages                                                                                            2   a la porte des Tournelles[1].
                                                                                                                 `
                                                                                                                                                                         1   aupr`s de la rue Saint-Antoine, a
                                                                                                                                                                                 e                            `
 Structural elements left from a document’s previous page division: page breaks, page num-
                                                                                                             3   [1] La Bastille, qui fut prise par le                   2   la porte des Tournelles_fnr29_.
bers, headers and footers.                                                                                   4   peuple de Paris, le 14 juillet 1789,                ⇒3      _fne8_
     Algorithm                                                                                               5   puis d´molie. B.
                                                                                                                       e                                                 4   ^L Quel etait en chemin l’´tonnement
                                                                                                                                                                                     ´                 e
       Function pages(text){                                                                                                                                             5   de l’Ing´nu! je vous le laisse a
                                                                                                                                                                                     e                       `
         page breaks = { page break characters ∪ page numbers }                                              6   ^L Quel etait en chemin l’´tonnement
                                                                                                                         ´                 e
         for ( x ∈ { page breaks }){
                                                                                                             7    de l’Ing´nu! je vous le laisse a
                                                                                                                           e                     `
            prec ← lines preceding x ; footers = footers ∪ { prec }
            foll ← lines following x ; headers = headers ∪ { foll }
         }
         Ignore headers/footers with number of occurrences < threshold
                                                                                                            2.5        Words and characters
         for ( y ∈ { headers ∪ footers }){                                                                   Sanitizing elements such as:
            Replace headers/footers with custom mark
            Add headers/footers to standoff file                                                                           • Unicode characters                              • Translineation
         }
       }                                                                                                                   • Text encoding                                   • Transpagination
                                                                                                                           • Glyphs
                          Table 1: Example excerpt before and after processed with pages

 1   le nabab, et assez audacieux                                                                           2.6        Commit
 2   pour s’emparer de sa personne.                                                                           Final step, which irreversibly removes all marks left behind by the previous steps and
 3                                                          1   le nabab, et assez audacieux                outputs the clean version of the text.
 4          Page 3                                          2   pour s’emparer de sa personne. _pb2_
 5   ^L La maison a vapeur Jules Verne
                  `
                                                        ⇒3        Le faquir, - evidemment le seul
                                                                               ´
 6                                                          4   entre tous que ne surexcitˆt pas
                                                                                          a                 3        Sections Ontology
 7     Le faquir, - evidemment le seul
                    ´                                                                                         An ontology is used to store information relevant to the sectioning process: types of sec-
 8   entre tous que ne surexcitˆt pas
                               a                                                                            tions and their relations, common section names, and ordinal and cardinal numbers. Each
                                                                                                            element in the ontology is translated to several different languages.
2.2         Sections                                                                                                                           Table 4: Excerpts from the sections ontology.

  Delimiting sections allows to:                                                                                 cap                       cena                         end                           3
                                                                Algorithm                                        PT cap´tulo, cap,
                                                                                                                        ı                  PT cena                      PT fim                        PT terceiro,
 • automatically generate tables of con-                                                                             capitulo              FR sc`ne
                                                                                                                                                e                       FR fin                           terceira,
                                                                  Function sections(text,ontology){
   tents;                                                           lines = lines from text                      FR chapitre, chap         EN scene                     EN the_end                       trˆs, tres
                                                                                                                                                                                                           e
 • identify sections from one version of a                          for ( x ∈ lines: x ∈ ontology ){             EN chapter, chap          BT act                       BT _alone                     EN third, three
   book that are missing on another ver-                              Add mark to text (before x)                RU глава                                                                             FR troisi`me,
                                                                                                                                                                                                               e
   sion;                                                            }                                            NT sec                                                                                  troisieme
 • matching and comparing the sections                            }                                                                                                                                   BT _numeral
   of two books before aligning them
                                                                                                             • ontology is being used to directly create the Perl code containing the complex data struc-
   (alignability);
                                                                                                               tures which are used in the process of sectioning;
 • perform additional processing on specific
                                                                                                             • the code is more readable and easier to maintain;
   sections.
                                                                                                             • the ontology can be used to discuss details with people with no programming experience.

                                                                                            http://per-fide.di.uminho.pt/

More Related Content

Recently uploaded

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Poster - Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text books

  • 1. Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text books Andr´ Santos, Jos´ Jo˜o Almeida e e a Table 2: Example excerpt before and after processed with sections Abstract 1 PRIMEIRA PARTE 1 _sec+N:part=1_ PRIMEIRA PARTE Several tasks which include text documents processing, such as text alignment, format 2 2 3 FANTINE conversions or information retrieval are heavily affected by the state of the original docu- 4 3 FANTINE 4 ments. 5 5 _sec+N:book=1_ LIVRO PRIMEIRO 6 ^L LIVRO PRIMEIRO Text::Perfide::BookCleaner is a Perl module to pre-process plain text books and 6 7 ⇒7 UM JUSTO clean them, getting them prepared for further arbitrary use. 8 UM JUSTO 8 Cleaning tasks include removing page breaks, page numbers, headers and footers; find- 9 9 O abade Myriel 10 O abade Myriel ing section titles and boundaries; removing footnotes and normalizing paragraph notation 11 10 11 Em 1815, era bispo de Digne, o and Unicode characters. The process is guided with the help of declarative objects such as 12 Em 1815, era bispo de Digne, o 12 reverendo Carlos Francisco Bemvindo 13 reverendo Carlos Francisco Bemvindo ontologies and configuration files. 2.3 Paragraphs 1 Motivation Several possible notations for paragraphs: Text processing (and particularly book alignment) are tasks whose perfor- new-line separated, blank-line separated, Algorithm mance is often negatively affected by: indented or not. Direct speech can also be Function paragraphs(text){ Calculate text’s word and delimited with quotation marks or preceded line metrics • Page structure • Paragraphs with a dash. Find paragraph notation • Section titles and boundaries • Character encoding etc. Some metrics based on the number of Normalize paragraph notation • Footnotes words, white spaces, empty and non-empty } lines can be used to infer the type of no- tation used, which can then be normalized. 2 Book cleaner 2.4 Footnotes Footnotes are formed by a call mark in the middle of the text, and the matching foot- Algorithm note expansion, which generally appears at Function footnotes(text) lines = lines from text the end of the same page. fnpattern = <<int>>, [int], ^int, ... Footnote expansions can often be found for ( x ∈ dom(lines) at the bottom of the page or, sometimes, at : x begins with fnpattern the end of the document. ∧ x is immediately before or after page break ){ Footnote call marks appear in the middle Replace x in text with custom mark of the text, usually consisting of some kind Add x to standoff file of numeration highlighted by some special } symbol. for ( y ∈ text : y ∈ fnpattern ){ Replace y in text with custom mark Add y to standoff file } } Table 3: Example excerpt before and after processed with footnotes 1 aupr`s de la rue Saint-Antoine, e 2.1 Pages 2 a la porte des Tournelles[1]. ` 1 aupr`s de la rue Saint-Antoine, a e ` Structural elements left from a document’s previous page division: page breaks, page num- 3 [1] La Bastille, qui fut prise par le 2 la porte des Tournelles_fnr29_. bers, headers and footers. 4 peuple de Paris, le 14 juillet 1789, ⇒3 _fne8_ Algorithm 5 puis d´molie. B. e 4 ^L Quel etait en chemin l’´tonnement ´ e Function pages(text){ 5 de l’Ing´nu! je vous le laisse a e ` page breaks = { page break characters ∪ page numbers } 6 ^L Quel etait en chemin l’´tonnement ´ e for ( x ∈ { page breaks }){ 7 de l’Ing´nu! je vous le laisse a e ` prec ← lines preceding x ; footers = footers ∪ { prec } foll ← lines following x ; headers = headers ∪ { foll } } Ignore headers/footers with number of occurrences < threshold 2.5 Words and characters for ( y ∈ { headers ∪ footers }){ Sanitizing elements such as: Replace headers/footers with custom mark Add headers/footers to standoff file • Unicode characters • Translineation } } • Text encoding • Transpagination • Glyphs Table 1: Example excerpt before and after processed with pages 1 le nabab, et assez audacieux 2.6 Commit 2 pour s’emparer de sa personne. Final step, which irreversibly removes all marks left behind by the previous steps and 3 1 le nabab, et assez audacieux outputs the clean version of the text. 4 Page 3 2 pour s’emparer de sa personne. _pb2_ 5 ^L La maison a vapeur Jules Verne ` ⇒3 Le faquir, - evidemment le seul ´ 6 4 entre tous que ne surexcitˆt pas a 3 Sections Ontology 7 Le faquir, - evidemment le seul ´ An ontology is used to store information relevant to the sectioning process: types of sec- 8 entre tous que ne surexcitˆt pas a tions and their relations, common section names, and ordinal and cardinal numbers. Each element in the ontology is translated to several different languages. 2.2 Sections Table 4: Excerpts from the sections ontology. Delimiting sections allows to: cap cena end 3 Algorithm PT cap´tulo, cap, ı PT cena PT fim PT terceiro, • automatically generate tables of con- capitulo FR sc`ne e FR fin terceira, Function sections(text,ontology){ tents; lines = lines from text FR chapitre, chap EN scene EN the_end trˆs, tres e • identify sections from one version of a for ( x ∈ lines: x ∈ ontology ){ EN chapter, chap BT act BT _alone EN third, three book that are missing on another ver- Add mark to text (before x) RU глава FR troisi`me, e sion; } NT sec troisieme • matching and comparing the sections } BT _numeral of two books before aligning them • ontology is being used to directly create the Perl code containing the complex data struc- (alignability); tures which are used in the process of sectioning; • perform additional processing on specific • the code is more readable and easier to maintain; sections. • the ontology can be used to discuss details with people with no programming experience. http://per-fide.di.uminho.pt/