Page MenuHomePhabricator

Add toolbar button for OCR cleanup
Open, Needs TriagePublicFeature

Description

Feature summary (what you would like to be able to do and where):

  • A new toolbar button to run common text replacements/changes on OCR text to improve punctuation, line-wrapping, etc.
  • The specific cleanups done need to be wiki-specific, so they can meet the style guides and make use of templates.
  • An icon needs to be selected or created. Perhaps checkAll would suffice for now:
    check all.png (20×20 px, 274 B)

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):

  • After loading text from a text layer of a file, or running OCR on an image, the resulting text often has errors that can be fixed by regular expressions or other programmatic changes.

Benefits (why should this be implemented?):

  • Save time for proofreaders.
  • Fix errors such as white space and the end of lines that might otherwise not be fixed by visual inspection.

Other information:

Event Timeline

so do we need something that does pretty much does exactly what the PageCleanup.js does? For the Wikimedia OCR?

Yes that's right. But it needs to be much more flexible than that script because it'll be used on different wikis. So perhaps it could have different groups of replacements, and the user could select which ones they want? Although often these scripts are a series of regexes, each assuming the previous have already been run, so there might be some extra complexity there to think about. There are quite a few variations around Wikisource of these scripts, it'd be worth investigating what they do and the choices they make.

The cleanup button in the toolbar could have a 'settings' dropdown next to it, where the different options could be configured (or perhaps it can be added to the OCR dropdown).

This comment was removed by VedHades.

I explored the existing PageCleanUp.js script and understand how it performs OCR text cleanup using regex-based transformations.

I plan to implement a simplified version of this functionality within the Wikisource extension. Initially, I will add a basic cleanup function along with a toolbar button.

Later, I aim to extend it with more flexible and configurable cleanup rules so it can adapt to different wiki requirements.