Skip to content

Instantly share code, notes, and snippets.

@dimnikolos
Created March 9, 2017 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimnikolos/a405315ffa23c821a0a41b1ffcf4079f to your computer and use it in GitHub Desktop.
Save dimnikolos/a405315ffa23c821a0a41b1ffcf4079f to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
#https://raw.githubusercontent.com/LibreOffice/dictionaries/master/el_GR/el_GR.dic
#save as utf-8
import codecs
rhString = 'ΠΟΙΘΥΛΚΞΗΜΝΒΌΊΎΉΪ'
lhString = 'ΕΡΤΑΣΔΦΓΖΧΨΩΈΆΏ'
print(rhString.decode('utf-8'))
rhMax = 0
rhCount = 0
lhMax = 0
lhCount = 0
with codecs.open('el_GR.dic','r',encoding = 'utf-8') as grDict:
for (num,line) in enumerate(grDict):
lineU = line.upper()
rhOnly = True
for key in lineU[:-1]:
if key not in rhString.decode('utf-8'):
rhOnly = False
break
lhOnly = True
for key in lineU[:-1]:
if key not in lhString.decode('utf-8'):
lhOnly = False
break
if rhOnly:
rhCount += 1
if len(line[:-1])>=rhMax:
rhMax = len(line[:-1])
print("Only right hand: " + line[:-1] + " (" + str(rhMax) + ")")
if lhOnly:
lhCount += 1
if len(lineU[:-1])>=lhMax:
lhMax = len(lineU[:-1])
print("Only left hand (CAPS): " + lineU[:-1] + " (" + str(lhMax) + ")")
print("Num of right hand words: " + str(rhCount))
print("Num of left hand words: " + str(lhCount))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment