Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re, subprocess
- class GreekWords:
- re_greek= re.compile('(?ui)[γδθλξπσςφψΐΰωώ]')
- def all_words(self):
- with subprocess.Popen(
- 'exec aspell -d el dump master | aspell -l el expand',
- shell=True, stdout=subprocess.PIPE, universal_newlines=True) as sub:
- yield from sub.stdout
- sub.wait()
- def most_greek(self):
- return max(self.all_words(), key=lambda i: len(self.re_greek.findall(i)))
- def most_unique_greek(self):
- return max(self.all_words(), key=lambda i: len(set(self.re_greek.findall(i))))
Advertisement
Add Comment
Please, Sign In to add comment