engram icon indicating copy to clipboard operation
engram copied to clipboard

calculating score of layout with minor tweaks

Open spamwax opened this issue 9 months ago • 5 comments

I was just wondering how I can run your code to calculate the score of default layout with 1 or 2 keys moved and/or swapped.

Given the higher frequency of letter G compared to J/K, and bigrams such as gh and ing, I wanted to know why it got assigned to current position (lower row of left pinky!!!). What if we swap G and Y, or G and J, or G and K? what would be the score compared to the original layout?

spamwax avatar Sep 29 '23 02:09 spamwax

The following is from the jupyter notebook under "Test 5" and is used to score layout variants/tweaks:

https://github.com/binarybottle/engram/blob/master/engram_layout_v2.0.ipynb

layouts_26letters = [ ['B','Y','O','U','C','I','E','A','G','X','J','K','L','D','W','V','H','T','S','N','R','M','F','P', '-','-','-', '-','-','-', 'Z','Q'], ['B','Y','O','U','C','I','E','A','G','X','J','K','L','D','W','V','H','T','S','N','R','M','F','P', '-','-','-', '-','-','-', 'Q','Z'], ['V','W','D','L','N','S','T','H','P','F','M','R','U','O','Y','B','A','E','I','C','K','J','X','G', '-','-','-', '-','-','-', 'Z','Q'], ['V','W','D','L','N','S','T','H','P','F','M','R','U','O','Y','B','A','E','I','C','K','J','X','G', '-','-','-', '-','-','-', 'Q','Z']] data_matrix = Factors32x32 scores_26letters = [] for layout_26letters in layouts_26letters: scores_26letters.append(score_layout(data_matrix, layout_26letters, bigrams, bigram_frequencies, verbose=False))

scores_26letters_sorted, ranks_26letters_sorted, Isort_26letters = rank_within_epsilon(scores_26letters, factor32, factor=True, verbose=False) print('\n Rank Score') for i, rank in enumerate(ranks_26letters_sorted): layout_string = layouts_26letters[Isort_26letters[i]] layout = ' '.join(layout_string) print(' {0}: {1} {2}'.format(rank, layout, scores_26letters_sorted[i]))

print('') print_layout24(layouts_26letters[0])

Rank Score 1: B Y O U C I E A G X J K L D W V H T S N R M F P - - - - - - Z Q 0.621987268013091 1: B Y O U C I E A G X J K L D W V H T S N R M F P - - - - - - Q Z 0.6219870422703005 1: V W D L N S T H P F M R U O Y B A E I C K J X G - - - - - - Q Z 0.6219847143830128 1: V W D L N S T H P F M R U O Y B A E I C K J X G - - - - - - Z Q 0.6219774708803041

binarybottle avatar Sep 29 '23 22:09 binarybottle

Or better still, run the comparison jupyter notebook, and at the bottom, tweak to your heart's content!:

https://github.com/binarybottle/engram/blob/master/compare_layouts.ipynb

# Workspace for manual comparisons
layouts_26letters = [
    ['B','Y','O','U','C','I','E','A','G','X','J','K','L','D','W','V','H','T','S','N','R','M','F','P', "'",',','-', '"','.','?', 'Z','Q'],
    ['W','Y','O','U','C','I','E','A','G','P','J','K', 'V','L','D','X','H','T','S','N','R','M','F','B', "'",',','-', '"','.','?', 'Z','Q']]

data_matrix = Factors32x32
scores_26letters = []
for layout_26letters in layouts_26letters:
    scores_26letters.append(score_layout(data_matrix, layout_26letters, bigrams, bigram_frequencies, verbose=False))

scores_26letters_sorted, ranks_26letters_sorted, Isort_26letters = rank_within_epsilon(scores_26letters, 
                                                                        factor32, factor=True, verbose=False)
print('\n    Rank                                                                   Score')
for i, rank in enumerate(ranks_26letters_sorted):
    layout_string = layouts_26letters[Isort_26letters[i]]
    layout = ' '.join(layout_string)
    print('    {0}:  {1}    {2}'.format(rank, layout, scores_26letters_sorted[i]))

binarybottle avatar Sep 29 '23 23:09 binarybottle

Thanks 🙏

spamwax avatar Sep 30 '23 00:09 spamwax

This is an excellent question:

Given the higher frequency of letter G compared to J/K, and bigrams such as gh and ing, I wanted to know why it got assigned to current position (lower row of left pinky!!!).

I think the answer is inward rolls! :sparkles: Since G is more frequent than J/K, its placement on the pinky finger allows it to engage with the vowel cluster for inward rolls: git, get, gat, got, gut. Consequently, if we were to swap G with J or K as you suggested*, that may result in suboptimal G + vowel bigrams for most vowels compared to the infrequent J and K letters taking G's place:

  • Swapping G with J:

    • get and got would have same-finger bigrams
    • git would contain an outward roll (G -> I)
  • Swapping G with K:

    • gut and gat would have same-finger bigrams
    • git, get, got would contain outward rolls

*Great idea by the way! :star_struck: I was consumed by this possibility until I realized the significance of placing G on the pinky finger.

sunaku avatar Oct 07 '23 06:10 sunaku

That's exactly right!


From: Suraj N. Kurapati @.> Sent: Friday, October 6, 2023 11:55:29 PM To: binarybottle/engram @.> Cc: Arno Klein @.>; Comment @.> Subject: Re: [binarybottle/engram] calculating score of layout with minor tweaks (Issue #69)

[EXTERNAL EMAIL] DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe.

This is an excellent question:

Given the higher frequency of letter G compared to J/K, and bigrams such as gh and ing, I wanted to know why it got assigned to current position (lower row of left pinky!!!).

I think the answer is inward rolls! ✨ Since G is more frequent than J/K, its placement on the pinky finger allows it to engage with the vowel cluster for inward rolls: git, get, gat, got, gut. Consequently, if we were to swap G with J or K as you suggested*, that may result in suboptimal G + vowel bigrams for most vowels compared to the infrequent J and K letters taking G's place:

  • get and got would be same-finger bigrams
  • git would contain an outward roll for G -> I

*Great idea by the way! 🤩 I was consumed by this possibility until I realized the significance of placing G on the pinky finger.

— Reply to this email directly, view it on GitHubhttps://github.com/binarybottle/engram/issues/69#issuecomment-1751627015, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AABZX5B773WI7UA7Z7KWG7DX6D4GDAVCNFSM6AAAAAA5L2AEBGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRGYZDOMBRGU. You are receiving this because you commented.Message ID: @.***>

This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message and any attachments

binarybottle avatar Oct 07 '23 14:10 binarybottle