Created
January 26, 2009 22:56
-
-
Save cv/53020 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[master!ioke]$ cat frequencies.ik | |
scriptFrequency = method(text, | |
count = {} withDefault(0) | |
text chars each(char, | |
count[char script] += 1 | |
) | |
count | |
) | |
scriptFrequency("Hi there, how are you?") println | |
scriptFrequency("ウィキペディアはオープンコンテントの百科事典です。基本方針に賛") println | |
scriptFrequency(" במאה ה-19, עם המצאת הטלפון, הפכה המילה למילת ברכה בינלאומית, בעיקר בשימוש כפותחת שיחות טלפון.") println | |
scriptFrequency("是英語中常用的問候語") println | |
[master!ioke]$ ioke frequencies.ik | |
{Common=6, Latin=16} | |
{Katakana=15, Common=2, Han=9, Hiragana=5} | |
{Hebrew=72, Common=22} | |
{Han=10} | |
[master!ioke]$ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[olabini-master!ioke]$ time ioke frequencies.ik | |
{Common=6, Latin=16} | |
{Common=2, Hiragana=5, Katakana=15, Han=9} | |
{Common=22, Hebrew=72} | |
{Han=10} | |
real 2m31.464s | |
user 2m21.231s | |
sys 0m2.273s | |
[olabini-master!ioke]$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[master!ioke]$ time ioke frequencies.ik | |
{Latin=16, Common=6} | |
{Han=9, Hiragana=5, Katakana=15, Common=2} | |
{Hebrew=72, Common=22} | |
{Han=10} | |
real 0m4.905s | |
user 0m4.486s | |
sys 0m0.169s | |
[master!ioke]$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment