<commit_before>#!/bin/bash

loi=$1

id_dossier=$(curl -sL "http://www2.assemblee-nationale.fr/recherche/amendements" |
  grep "<option.*Texte.* $loi[,)]" |
  sed -r 's/^.*value="([0-9]+)".*$/\1/')

if ! echo "$id_dossier" | grep -P "^\d+$" > /dev/null; then
  echo "Cannot find a dossier id for loi $loi in http://www2.assemblee-nationale.fr/recherche/amendements"
  exit 1
fi

curl -sL "http://www2.assemblee-nationale.fr/recherche/query_amendements?typeDocument=amendement&idDossierLegislatif=$id_dossier&typeRes=facettes" |
  grep "examen" |
  sed 's/{/\n/g' |
  grep "[lL]ect.* - $loi -" |
  sed -r 's/^.*val":"([0-9]+)".*$/\1/' |
  while read id_examen; do
    echo "$id_dossier;$id_examen"
  done <commit_msg>Ajout du numéro de legislature par l'AN<commit_after>#!/bin/bash

loi=$1

id_dossier=$(curl -sL "http://www2.assemblee-nationale.fr/recherche/amendements" |
  grep "<option.*Texte.* $loi[,)]" |
  sed -r 's/^.*value="([0-9]+)".*$/\1/')

if ! echo "$id_dossier" | grep -P "^\d+$" > /dev/null; then
  echo "Cannot find a dossier id for loi $loi in http://www2.assemblee-nationale.fr/recherche/amendements"
  exit 1
fi

curl -sL "http://www2.assemblee-nationale.fr/recherche/query_amendements?leg=15&typeDocument=amendement&idDossierLegislatif=$id_dossier&typeRes=facettes" |
  grep "examen" |
  sed 's/{/\n/g' |
  grep "[lL]ect.* - $loi -" |
  sed -r 's/^.*val":"([0-9]+)".*$/\1/' |
  while read id_examen; do
    echo "$id_dossier;$id_examen"
  done 
{'fraction_non_alphanumeric': 0.21667805878332194, 'fraction_numerical': 0.016404647983595352, 'mean_word_length': 3.8637873754152823, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4310245', 'n_tokens_mistral': 681, 'n_tokens_neox': 645, 'n_words': 114}