Keyboard Layout Classifier

This project uses a neural network to classify whether a given word is better optimized for typing on a QWERTY or Dvorak keyboard layout.

What It Does

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)

Model

Features Used for Training

For each word, we calculate:

FeatureDescription
home_row_scoreBonus points for letters on the home row
bigram_bonusBonus for specific letter pairs (e.g., ck, th)
frequency_scoreWeighted sum of character frequency in English
movement_costTotal key travel distance across the keyboard

These were calculated separately for QWERTY and Dvorak layouts to generate training labels.

🛠 How to Use

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)