Skip to content

Legilibre/DuraLex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DuraLex

Build Status Gitter

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.

Installation

Requirements:

  • Python 3+
  • pip
pip install -r requirements.txt

Usage

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:

./duralex --file pion1561.html
./duralex --url http://www.assemblee-nationale.fr/14/propositions/pion1561.asp
curl -s http://www.assemblee-nationale.fr/14/propositions/pion1561.asp | ./duralex
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

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:

{
  "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

cd tests
python main.py

Related projects

About

DuraLex is a French bill compiler.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages