Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Legilibre/DuraLex

DuraLex is a French bill compiler.
https://github.com/Legilibre/DuraLex

Last synced: 2 months ago
JSON representation

DuraLex is a French bill compiler.

Awesome Lists containing this project

README

        

# DuraLex

[![Build Status](https://img.shields.io/travis/Legilibre/DuraLex.svg)](https://travis-ci.org/Legilibre/DuraLex)
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/Legilibre/DuraLex)

DuraLex is a French bill compiler. It takes an official bill document written in plain natural French and transforms
it into an automatable semantic data structure. This data structure describes the content of the bill, including but
not limited to:

* the id and type of the bill
* articles and sections/headers
* each edit with the corresponding operators (add, remove, replace...) and operands (words, articles...)
* references to existing laws, codes, articles, headers...
* definition of new articles, headers...

DuraLex is the backend for [SedLex](https://github.com/Legilibre/SedLex).

## Installation

Requirements:

* Python 3+
* pip

```bash
pip install -r requirements.txt
```

## Usage

```bash
usage: duralex [-h] [--file FILE] [--url URL] [--amendments] [--quiet] [--uuid]

optional arguments:
-h, --help show this help message and exit
--file FILE the path of the bill to process
--url URL the URL of the bill to process
--quiet no stdout output
--uuid add a unique ID on each node
--amendments fetch and include amendments for the specified bill
```

Examples:

```bash
./duralex --file pion1561.html
```
```bash
./duralex --url http://www.assemblee-nationale.fr/14/propositions/pion1561.asp
```
```bash
curl -s http://www.assemblee-nationale.fr/14/propositions/pion1561.asp | ./duralex
```
```bash
cat http://www.assemblee-nationale.fr/14/propositions/pion1561.asp | ./duralex
```

## Intermediary representation

### Principle

DuraLex turns plain text into a standardized JSON tree structure intermediary representation.
This standardized intermediary representation can then be used as an input for other (third party) tools.

![article to json](article_to_json.jpg)

### Example

The following bill article:

```
L'article 11 de la loi n° 78-753 du 17 juillet 1978 portant diverses mesures d'amélioration des relations entre l'administration et le public et diverses dispositions d'ordre administratif, social et fiscal est abrogé.
```

will give the following intermediary representation:

```json
{
"children": [
{
"children": [
{
"children": [
{
"children": [
{
"id": "11",
"type": "article-reference"
}
],
"lawDate": "1978-7-17",
"id": "78-753",
"type": "law-reference"
}
],
"editType": "delete",
"type": "edit"
}
],
"isNew": false,
"order": 1,
"type": "article"
}
]
}
```

## Tests

```bash
cd tests
python main.py
```

## Related projects

* https://github.com/Legilibre/SedLex
* https://github.com/Legilibre/NuitCodeCitoyen
* https://github.com/Legilibre/Archeo-Lex
* https://github.com/regardscitoyens/the-law-factory-parser