Share your questions, suggestions for improvement, praise or criticism with us anytime.

You can also reach out to us through our social media channels.

+4915901950372
info@tigrinya.de

Blog

HomeFooterThe most frequent letter or „fidel“

The most frequent letter or „fidel“

The most frequent letter in Tigrinya corpora (texts) is “ን”.
It is not really surprising that the most frequent one in Amharic is also “ን”.
Here is a suitable python script:

# -*- coding: utf-8 -*-
import codecs
o = codecs.open(“o.txt”, “w”, encoding=”utf-8″)
f = codecs.open(“test_text.txt”, “r”, encoding=”utf-8″)
fidels = { “ሀ”.decode(“utf-8″):0, “ሁ”.decode(“utf-8″):0, “ሂ”.decode(“utf-8″):0, “ሃ”.decode(“utf-8″):0, … }
for i in f:
for j in i:
if j in fidels:
fidels[j] = fidels[j] + 1 #vorkommen des jew. fidels im text zaehlen
highest = 0
highest_fidel = “”
for i in fidels:
if fidels[i] > highest:
highest = fidels[i] #hoechstes finden, gibt es ein hoeheres -> ueberschreiben
highest_fidel = i
o.write(“most frequent Fidel: “)
o.write(highest_fidel)
o.write(str(highest))
second_highest = 0
second_highest_fidel = “”
fidels.pop(highest_fidel)
for i in fidels:
if fidels[i] > second_highest:
second_highest = fidels[i]
second_highest_fidel = i
o.write(“\n2nd most frequent Fidel: “)
o.write(second_highest_fidel)
o.write(str(second_highest))
third_highest = 0
third_highest_fidel = “”
fidels.pop(second_highest_fidel)
for i in fidels:
if fidels[i] > third_highest:
third_highest = fidels[i]
third_highest_fidel = i
o.write(“\n3rd most frequent Fidel: “)
o.write(third_highest_fidel)
o.write(str(third_highest))

Example Output from one big text (after the Fidel stands the number of occurrences):
most frequent Fidel: ን 118
2nd most frequent Fidel: ኣ 116
3rd most frequent Fidel: ብ 113

POST A COMMENT