This is a work in progress and might not work correctly.
An evolution based AI that tries to generate a keyboard with the best possible layout for the swedish language.
The AI is based on a genetic algorithm. The keyboard is represented as a string of characters. The fitness function is based on the distance between the characters.
The algorithm is based on the following steps:
- Generate a population of keyboards.
- Calculate the fitness of each keyboard based on a swedish dataset of random texts.
- Select 10% of the best keyboards, breed some of the best 50% of keyboard, and add 40% of random keyboards to the population.
- Repeat from step 2
- Create a virtual environment and install the requirements with
pip install -r requirements.txt
- Run the program with
python3 main.py -g <number_of_evolutions> -p <population_size>
Type python3 main.py -h
to get a list of commands.
Here is the final generated keyboard from the image below. We can see that the letters in the middle row (the row where the fingers rest) are letters that are common.
åtuch.bx,äd
amislnoerkg
jzövwpqfy
The 5 most common letters in the swedish alphabet are a
, e
, t
, n
and r
, 4 of which are in the middle row of the generated keyboard.
The idea is based on the following youtube video: https://www.youtube.com/watch?v=EOaPb9wrgDY