Logo Lanfrica

ipipan/tanzania-parliament-parser

Domain:

natural language processing

Record type:

software
Creator:
ipi
Host:
# Tanzania ParlaMint Parser A Python library and CLI tool for parsing Swahili-language Tanzanian Parliamentary (*Bunge*) official transcript (stenogram) PDF files into structured JSON and standard **ParlaMint TEI XML** format. ## Features - **Metadata Extraction**: Automatically extracts header metadata including Assembly (*Mkutano*), Session (*Kikao*), Sitting date, start time, presiding prayer officer, and tabled documents (*Hati Zilizowasilishwa Mezani*). - **Formatting-Aware PDF Extraction**: Utilizes `pdfplumber` to analyze font properties (such as bold weight and font sizing) to distinguish speaker names, minister titles, parenthetical notes, question numbers/titles, and speech text. - **ParlaMint TEI XML Export**: Converts parsed transcripts into Parla-CLARIN standard TEI XML format (` `) complete with metadata ` `, speaker taxonomy ` `, and speech utterances ` ` and ` `. - **Corpus Batch Processing (`teiCorpus`)**: Batch processes entire directories of PDF stenograms, organizing output files into year-based subdirectories (`output_dir/YYYY/ParlaMint-TZ_YYYY-MM-DD_slug.xml`) and generating a top-level `ParlaMint-TZ.xml` (` `) manifest with XInclude (` `) component references matching official ParlaMint specifications. - **Command Line Interface (CLI)**: Provides command-line tools for single PDF parsing, JSON-to-TEI conversion, and batch directory processing. --- ## Installation ### Prerequisites - Python >= 3.9 ### Install Package Clone the repository and install dependencies: ```bash git clone github.com cd tanzania_parlamint_parser pip install -e . ``` To install development dependencies (for running tests): ```bash pip install -e ".[dev]" ``` --- ## Quick Start ### 1. Python API #### Parse PDF to Dataclass or JSON ```python from pathlib import Path from tanzania_parlamint_parser import parse_pdf, SittingStenogram # Parse a parliamentary PDF file result: SittingStenogram = parse_pdf("path/to/st …

Tasks

Languages