Skip to content

Engram-es Q & U positions #47

Description

@binarybottle

The following was an email sent to me on 26 Nov 2024:

Hi,

I've been trying to optimize Russian layout and searching for scientific papers found your project. (IDK why Google Scholar doesn't show it on top. All I found was irrelevant.) Great that someone did a serious research paper and published a notebook, thanks for your work! I'll try running the code on my experimental layouts to see how it ranks them.

But there's a problem. I paid attention at your Spanish layout and tried to imagine typing in Spanish (I looked at the letters and moved the appropriate fingers imagining typing something like "y para entender lo que el ha propuesto...") I found out Q & U are placed very inconveniently: words like "que", "fue", "fuera", "puede", "aquel" require quite awkward moves between index finger and middle finger on the left hand.

My gut feeling told me they must be more outwards, because E/A/O often come after them as in the words I mentioned. So I calculated a metric that I used in my research: how many incoming & outgoing bigrams the letter has on the same hand. If bigram starts with the letter in question, it's "outgoing", if it ends, it's "incoming". I counted number of bigrams for your Spanish layout's left hand side. And turns out I was right: letter U wants to be much to the left of E/A/O. But "Q" wants to be even lefter.
You can run this code in your jp notebook after the code that defines bigrams frequencies:

import pandas as pd
d = pd.DataFrame({'bigram': bigrams, 'freq': bigram_frequencies})
d['l1'] = d.bigram.str[0]
d['l2'] = d.bigram.str[1]
left = ['A', 'E', 'I', 'O', 'U', 'Z', 'H', 'P', 'F', 'X', 'Q', 'Y']
d2 = d[d.l1.isin(left) & d.l2.isin(left)]
t2 = d2.groupby('l1').agg({'freq': 'sum'}).join(d2.groupby('l2').agg({'freq': 'sum'}), lsuffix='_out', rsuffix='_in').reset_index()
t2['delta'] = t2.freq_in - t2.freq_out
t2.sort_values('delta')

Output:

l1 freq_out freq_in delta
I 32120017 10431392 -21688625
P 24677708 5852291 -18825417
Q 12474918 1430018 -11044900
H 11195057 660160 -10534897
U 24643760 19815896 -4827864
F 7648289 2845112 -4803177
Z 3565688 3871776 306088
Y 2505993 2944683 438690
X 1207193 1762383 555190
O 3760162 24776548 21016386
A 7776678 31177035 23400357
E 8925375 34933544 26008169

In my reseach, I did use such queries in Pandas quite a lot, and optimized consciously, rather than use optimization algorithms. Another metric I had was "how much is the key connected with the keys in the same row" -- to see if some keys could be moved elsewhere, or should have stayed where they were.

I wonder why Q & U got there where they were? Is it because top row rf & pinky are penalized?

Anyway, many thanks for posting your code. I see I was going in the right direction.
Best regards,

Dmitri

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions