Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save caglarorhan/ccef0b94e2e00bc4a9570adc2534675e to your computer and use it in GitHub Desktop.

Select an option

Save caglarorhan/ccef0b94e2e00bc4a9570adc2534675e to your computer and use it in GitHub Desktop.
five letter Turkish words letter-position frequency
let freq = {
a: { '0': 336, '1': 1434, '2': 163, '3': 1006, '4': 592 },
b: { '0': 371, '1': 34, '2': 164, '3': 67 },
c: { '0': 121, '1': 17, '2': 100, '3': 142 },
'ı': { '0': 30, '1': 229, '2': 23, '3': 374, '4': 216 },
d: { '0': 309, '1': 32, '2': 200, '3': 99, '4': 1 },
i: { '0': 209, '1': 545, '2': 80, '3': 774, '4': 351 },
l: { '0': 113, '1': 126, '2': 571, '3': 294, '4': 312 },
n: { '0': 135, '1': 89, '2': 389, '3': 108, '4': 516 },
'ş': { '0': 100, '1': 45, '2': 163, '3': 19, '4': 216 },
o: { '0': 82, '1': 441, '2': 38, '3': 147, '4': 81 },
z: { '0': 89, '1': 65, '2': 263, '3': 53, '4': 197 },
s: { '0': 488, '1': 84, '2': 320, '3': 97, '4': 156 },
e: { '0': 209, '1': 902, '2': 82, '3': 650, '4': 492 },
h: { '0': 271, '1': 33, '2': 168, '3': 21, '4': 59 },
y: { '0': 236, '1': 49, '2': 246, '3': 84, '4': 50 },
k: { '0': 594, '1': 73, '2': 399, '3': 119, '4': 620 },
r: { '0': 115, '1': 171, '2': 640, '3': 175, '4': 448 },
u: { '0': 48, '1': 373, '2': 26, '3': 382, '4': 120 },
m: { '0': 332, '1': 48, '2': 357, '3': 287, '4': 312 },
'ç': { '0': 218, '1': 29, '2': 86, '3': 80, '4': 102 },
g: { '0': 222, '1': 6, '2': 94, '3': 102, '4': 2 },
'ö': { '0': 63, '1': 173, '2': 6, '3': 19, '4': 2 },
t: { '0': 368, '1': 62, '2': 332, '3': 127, '4': 373 },
f: { '0': 150, '1': 37, '2': 115, '3': 23, '4': 77 },
'ğ': { '1': 27, '2': 113, '3': 2, '4': 12 },
p: { '0': 169, '1': 25, '2': 159, '3': 35, '4': 98 },
v: { '0': 95, '1': 44, '2': 210, '3': 40, '4': 21 },
j: { '0': 10, '1': 4, '2': 9, '3': 6, '4': 22 },
'ü': { '0': 49, '1': 335, '2': 16, '3': 200, '4': 84 }
}
let createLetterPositionMap=(wordList)=>{
let letterPositionMap={};
wordList.forEach(word=>{
word.split('').forEach((letter,index)=>{
if(!letterPositionMap[letter]){
letterPositionMap[letter]={};
}
if(letterPositionMap[letter][index]){
letterPositionMap[letter][index]++
}else{
letterPositionMap[letter][index]=1
}
})
})
Object.keys(letterPositionMap).forEach(letter=>{
for(let x=0;x<this.wordLength;x++){
if(!letterPositionMap[letter][x]){
letterPositionMap[letter][x]=0;
}
}
})
return letterPositionMap;
}
@caglarorhan
Copy link
Author

Fonksiyondaki 2. kisim calismamis. Yeniden bakacagim. Harflerin yer almadigi pozisyonlardaki sayisi 0 (sifir ) olmali.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment