#!/usr/bin/env python # -*- coding: utf-8 -*- from unicodedata import name,category import hrm """ we want to see what the ratios of the frequencies of the the first to second most frequent words is for all languages in the udhr """ huu = hrm.udhr['huu'] hits = [(float(lang.wordfreq[lang.topword])/lang.wordfreq[lang.secondword]) for k,lang in hrm.udhr.items()] for x in sorted(hits): print x [(lang.code, lang.language) for x,lang in hrm.udhr.items() if (float(lang.wordfreq[lang.topword]) == lang.wordfreq[lang.secondword])] [(len(lang.text), lang.language) for x,lang in hrm.udhr.items() if (float(lang.wordfreq[lang.topword]) == lang.wordfreq[lang.secondword])] for lg,first,second, [(len(lang.text), lang.language) for x,lang in hrm.udhr.items() if (float(lang.wordfreq[lang.topword]) == lang.wordfreq[lang.secondword])] for c in u" እያንዳንዱ፡ሰው፡የራሱ፡ነጻነትና፡ሙሉ፡መሻሻል፡በሚያገኝበት፡ኀብረሰብ፡ውስጥ፡የሚፈጽማቸው፡ግዴታዎች፡ይኖሩበታል።": print c, name(c), category(c)