#!/usr/bin/env python # Setup project environment in the parent directory. import os import sys sys.path[0] = os.path.dirname(sys.path[0]) from languages.utils import word_score from languages import english, spanish, french, german WORDS = """ ich mit einem wenig kostenlosen begabten verschraubenden Fuchs Traum Menschenfresser Dampfschiffahrt Dampfschifffahrt me with another little inexpensive ridiculous interlocking Python beautiful illusionist Antidisestablishmentarianism """.split() print '%-8s %-8s %-8s %-8s %s' % tuple( 'english spanish french german word'.split()) for word in WORDS: print '%-8d %-8d %-8d %-8d %s' % ( word_score(word, english.TRIPLE_SCORES), word_score(word, spanish.TRIPLE_SCORES), word_score(word, french.TRIPLE_SCORES), word_score(word, german.TRIPLE_SCORES), word, )
def update_language_scores(self): from languages import english, spanish, german, french self.english = word_score(self.key().name(), english.TRIPLE_SCORES) self.spanish = word_score(self.key().name(), spanish.TRIPLE_SCORES) self.german = word_score(self.key().name(), german.TRIPLE_SCORES) self.french = word_score(self.key().name(), french.TRIPLE_SCORES)
#!/usr/bin/env python # Setup project environment in the parent directory. import os import sys sys.path[0] = os.path.dirname(sys.path[0]) from languages.utils import word_score from languages import english, spanish, french, german WORDS = """ ich mit einem wenig kostenlosen begabten verschraubenden Fuchs Traum Menschenfresser Dampfschiffahrt Dampfschifffahrt me with another little inexpensive ridiculous interlocking Python beautiful illusionist Antidisestablishmentarianism """.split() print "%-8s %-8s %-8s %-8s %s" % tuple("english spanish french german word".split()) for word in WORDS: print "%-8d %-8d %-8d %-8d %s" % ( word_score(word, english.TRIPLE_SCORES), word_score(word, spanish.TRIPLE_SCORES), word_score(word, french.TRIPLE_SCORES), word_score(word, german.TRIPLE_SCORES), word, )
#!/usr/bin/env python # Setup project environment in the parent directory. import os import sys sys.path[0] = os.path.dirname(sys.path[0]) from common.appenginepatch.aecmd import setup_env setup_env() from languages import english from languages.utils import word_score LETTERS = 'abcdefghijklmnopqrstuvwxyz' for c1 in LETTERS: for c2 in LETTERS: for c3 in LETTERS: for c4 in LETTERS: for c5 in LETTERS: word = ''.join((c1, c2, c3, c4, c5)) score = word_score(word, english.TRIPLE_SCORES) if score > 0.5: print '%.5f %s' % (score, word)