Metadata-Version: 2.1
Name: europarl-amendment-extract
Version: 1.1.0
Summary: Extract amendments from European Parliament docx files
Author: Sebastien Campion
License: MIT
Description-Content-Type: text/markdown
Requires-Dist: beautifulsoup4==4.12.2
Requires-Dist: ipython==8.13.2
Requires-Dist: pip-chill==1.0.3
Requires-Dist: python-docx==0.8.11
Requires-Dist: xmltodict==0.13.0
Requires-Dist: requests==2.31.0
Requires-Dist: jsondiff==2.0.0
Requires-Dist: python-levenshtein==0.21.0
Requires-Dist: tqdm==4.65.0

EuroParl-Amendment-Extract
===========================

This is a simple script to convert the amendments from the EP to JSON.
It follow the format define in that dataset https://zenodo.org/record/4709248#.YXesJS8itqs for the article War Of Word
https://github.com/indy-lab/war-of-words

## prerequisites

Build the MEPs dataset with the script 
`python3 meps.py`


## Debugger

To run the debugger we simply need to run 'streamlit run diff_visualizer.py', it will run the am labeler on the ep8 dataset and visualize the first error that it comes across. 


## Sequence matcher update

In diff.py there is now a extract_opcodes and extract_opcodes_v2. The v2 takes into account to merge consecutive 'replace' operations as well as 'delete' operations followed by a replace. We also display now at the end an accuracy metric that sort of roughly sketches the am labeler's performance. The accuracy is calculated by penalizing the algorithm for each edit that it gets wrong relative to the size / length of text that was attributed to the edit in question. With this evaluation metric we observed a high accuracy (99+ %) on the ep8 dataset. 


## Usage 

```python
from ep_amendment_extract import  extract_amendments

extract_amendments('file.docx')
```
