This project uses a neural network to classify whether a given word is better optimized for typing on a QWERTY or Dvorak keyboard layout.
You input a word like hello
, and the model predicts whether it's more "natural" to type on a QWERTY or Dvorak keyboard, based on:
The model outputs a score between 0 and 1 — values near 1 mean the word is likely Dvorak, values near 0 suggest QWERTY, and scores around 0.5 indicate uncertainty.
Example:
$ python classify_word.py typewriter
'typewriter' → QWERTY (0.00)
For each word, we calculate:
Feature | Description |
---|---|
home_row_score | Bonus points for letters on the home row |
bigram_bonus | Bonus for specific letter pairs (e.g., ck, th) |
frequency_score | Weighted sum of character frequency in English |
movement_cost | Total key travel distance across the keyboard |
These were calculated separately for QWERTY and Dvorak layouts to generate training labels.
Clone the repo
Ensure you have Python 3 and install dependencies:
pip install tensorflow scikit-learn joblib
Run the classifier on any word:
python classify_word.py hello
To classify multiple words:
for word in hello world typewriter function zoo; do \
python3 classify_word.py "$word" 2>/dev/null; \
done
Output:
'hello' → Dvorak (0.60)
'world' → QWERTY (0.47)
'typewriter' → QWERTY (0.00)
'function' → QWERTY (0.00)
'zoo' → QWERTY (0.30)