Skip to main content

Choco-Mufin

[CHaracter Ocr COordination for MUFI iN texts]

Tools for normalizing the use of some characters and checking file consistencies. Mainly target at dealing with overly diverse ways to transcribe medieval data (allographetic and graphematic for example) while keeping information such as abbreviation, hence MUFI.

Install

pip install chocomufin

Commands

The workflow is generally the following: you generate a conversion table (chocomufin generate table.csv your-files.xml), then use this table to either control (chocomufin control table.csv your-files.xml) or convert them (chocomufin convert table.csv your-files.xml). Conversion will automatically add a suffix which you can define with --suffix.

Table of conversion

Syntax

A conversion table MUST contain at least a char and a replacement column, SHOULD contain a regex and allow column (with either true or empty values), and MAY contain any additional column.

The columns have the following effect:

  • char is used to match a value in the XML or the text.
  • replacement is used to replace what was found in char.
  • regex, if true, means char and replacement should be parsed as regex.
  • allow, if true, will indicate that replacement should be ignored, and that the value(s) in char are valid.

Any other column should be seen as a comment.

Example

In the following table:

lineno,char,replacement,regex,allow
1,V,U,,
2,[a-ik-uw-zA-IK-UW-Z],,true,true
3,(\S)(\.)(\S),\g<0>\g<1> \g<2>,true,
4,_,,,true
  • Line no. 1 will replace any V into a U;
  • Line no. 2 will allow any character in the range defined: those characters won't be replaced and will be accepted as is.
  • Line no. 3 will replace any dot without spaces around it with a regex replacement groups used in the regex.
  • Line no. 4 will allow _ in the text, and not replace it with anything.

As table:

lineno char replacement regex allow
1 V U
2 [a-ik-uw-zA-IK-UW-Z] true true
3 (\S)(.)(\S) \g<1>\g<2> \g<3> true
4 _ true

In this context, lineno is not used at all by chocomufin, but serves as a documentation tool. It would not break chocomufin.

Github Action Template

Just replace the path to table.csv and the file that needs to be tested, then save this file on your repository in .github/workflows/chocomufin.yml:

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: ChocoMufin

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: 3.8
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install chocomufin
    - name: Run ChocoMufin
      run: |
        chocomufin control table.csv **/*.xml

Logo by Alix Chagué.

The file original_mufi_json's content is under CC BY-SA 4.0 and comes from https://mufi.info/m.php?p=mufiexport

Metadata

Release files for chocomufin 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chocomufin 1.0.2
File Size Uploaded
chocomufin-1.0.2.tar.gz 46.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chocomufin 1.0.2
File Interpreter ABI Platform
chocomufin-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 85.3 kB

Release files / chocomufin-1.0.2.tar.gz

Download URL chocomufin-1.0.2.tar.gz
Size 46.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2296614ea44b489b67a7adf0e9a2eec0165cb2b0190bab7cc2321299d8c6f521
BLAKE2b-256 checksum
How to use checksums
15f62394ca8703e1b6b1d2112ba92e627fc352b321fb4ffd8cfedcabbdc443af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / chocomufin-1.0.2-py3-none-any.whl

Download URL chocomufin-1.0.2-py3-none-any.whl
Size 38.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a021b3caf622db4505a8a695e4e9824309ab4eabb48629aacc317a4946d18c9
BLAKE2b-256 checksum
How to use checksums
742ad812ca8aaed7c2917eb8237e71279c2e155e3cb014b81ef3d23e10686e3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

3 release files

1.0.0

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page