Un générateur de nom de communes, basé sur les noms de communes françaises.
Go to file
Feufochmar ac0133eee4 Fix URL 2022-05-23 13:12:38 +02:00
web Use the name gener-communes for the HTML element that is replaced by the generator 2019-11-06 12:33:57 +01:00
COPYING Add licence and readme 2019-11-06 12:36:32 +01:00
README.md Fix URL 2022-05-23 13:12:38 +02:00
distribution.rkt Add distrbution & markov 2019-11-04 17:22:49 +01:00
extract.sh Add script to download and generate the model 2019-11-06 12:34:49 +01:00
extractor.rkt Move the json representation in the web folder 2019-11-05 17:39:29 +01:00
make-archive.sh Add script to make the itch.io archives 2019-11-06 12:36:56 +01:00
markov.rkt Add distrbution & markov 2019-11-04 17:22:49 +01:00
name-generator.rkt Move the json representation in the web folder 2019-11-05 17:39:29 +01:00

README.md

Gener'Communes

A small generator of names of French municipalities.

Based on the 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 (<script src='gener-communes.js'></script> 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: <script>genercommunes.load('data.json')</script>)