From 6892ef59913b5bf054099e4cf069eab8d43e03c1 Mon Sep 17 00:00:00 2001 From: Feufochmar Date: Wed, 6 Nov 2019 12:36:32 +0100 Subject: [PATCH] Add licence and readme --- COPYING | 19 +++++++++++++++++++ README.md | 26 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 COPYING create mode 100644 README.md diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..a57eb22 --- /dev/null +++ b/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2019 Feufochmar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c2490f3 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Gener'Communes +A small generator of names of French municipalities. + +Based on the [https://www.data.gouv.fr/fr/datasets/referentiel-geographique-francais-communes-unites-urbaines-aires-urbaines-departements-academies-regions/](list of all municipalities), +this tool analyses the names and extracts the words forming the names to train a model of names. +Names can then be generated from the model. + +There is a model for each departement, so the names can be generated at a departement level. +The web interface aggregates the models to form additional generators: by regions and for the whole set. + +## Generating the model +The extractor uses Racket. +The script `extract.sh` downloads the list of municipalities from the original source and call the `extractor.rkt` script to generate the file `web/gener-communes.json` containing the models. + +## Generating names +There is two ways to generate names: +- by using the `name-generator.rkt` script (generates 100 names) +- by using the web interface (one at a time) + +## Web interface +The `web` directory contains a sample web interface to generate names from the JSON model. +The implementation of generators is located in the script `web/gener-communes.js`. +To use it on any webpage: + - include the script on your page (`` in the headers) + - add a div (or another block element) with the `gener-communes` id + - call the `genercommunes.load()` function with the JSON file to use as an argument (either in the `onload` method of the body, or in a script tags placed after the `gener-communes` block ex: ``)