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:
charis used to match a value in the XML or the text.replacementis used to replace what was found in char.regex, iftrue, meanscharandreplacementshould be parsed as regex.allow, iftrue, will indicate that replacement should be ignored, and that the value(s) incharare 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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chocomufin-1.0.2.tar.gz | 46.6 kB | Without provenance | Details for chocomufin-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chocomufin-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for chocomufin-1.0.2-py3-none-any.whl |
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
|
Security for chocomufin 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.