2021-01-01ãã1å¹´éã®è¨äºä¸è¦§
I made a Japanese-English dictionary for Kindle from WordNet, Wiktionary, and EDict2. You can download the data for free. This post describes how I made it. Because the main users are supposed to be English speakers, I write this article inâ¦
KZ ZASã¨ããããããã³ï¼ã¤ã¤ãã³ï¼ãè²·ã£ã¦è¯ãã£ãã¨ãã話ãKZ ZS10 proãè²·ã£ãã¨ãã話ã以åã«æ¸ããããåãã¡ã¼ã«ã®ææ°è£½åã§ããã
WordNetã¨Wiktionaryãçµ±åããè¾æ¸ãä½ã£ã¦ãããããKindleç¨ã®è¾æ¸ãçæãã¦ããããã®éã«ã¯ãWordNetç±æ¥ã®èªç¾©ã¨Wiktionaryã®èªç¾©ã®ä¸¡æ¹ãæ²è¼ããã¨é·ããªããããã®ã§ãWordNetã®èªç¾©ãããã°ããã使ããããã§ãªãå ´åã«ã®ã¿Wiktionaryã®èªç¾©ã使â¦
ãã ãããªããã£ã¦è±èªã§ãªãã¦è¨ãã°ããããããã ããããæèã«å¿ããé©åãªèªãé¸æããã«ã¯ãè¾æ¸ã«ãªãã¹ãå¤ãã®è¨³èªãåé²ãã¦ããå¿ è¦ããããããã§ãWordNetãWiktionaryã®çµ±åè±èªè¾æ¸ã«ãããªã¼ã®åè±è¾æ¸EDict2ãããã«çµ±åãã¦ã«ãã¬ãã¸ãâ¦
WordNetã¨Wikitionaryããçæãã¦çèªæ¤ç´¢ãã§ããèªä½ã®è±åè¾æ¸ãKindleã®å®æ©ï¼Paperwhiteï¼ã«å ¥ãã¦å¿«é©ã«ä½¿ã£ã¦ããããåããã®ãAndroidãPCï¼Macï¼ã§ã使ãæ¹æ³ãã¡ã¢ããããã¡ãããç§ã®è¾æ¸ã§ãªãã¦ãä»»æã®ã«ã¹ã¿ã è¾æ¸ãå©ç¨ãããã¨ãã§ããã
ããªã¼è±åè¾æ¸æ¤ç´¢ã·ã¹ãã ã¨ãã®Kindleç¨è¾æ¸ãã¼ã¿ã«ã¦ãçèªã®è¨³èªã表示ã§ããããã«ãã話ãè±æèªè§£ãããä¸ã§çèªã®ç解ã¯å¿ é ãªã®ã§ããã®æ¯æ´ãã§ãããã¨ã¯éè¦ã ãããããçèªãé¸æãã¦æ¤ç´¢ããã®ã¯é£ãããããã§ãä¸å¿ã¨ãªãåèªã調ã¹ãã¨â¦
天æ°ãè¯ãã£ãã®ã§ãé½å¿é¨ã®ãµã¤ã¯ãªã³ã°ã«åºããã¦ã¿ããã¤ãã§ã«ã空ãåããã¨ãããã¨ã§ããªãªã³ãã¹ã®éç¼ããã£ãã£ããã¬ã³ãºBCL0980ã ãã§åæãæ®ãã¨ãã趣åã«ãã¦ã¿ãã
Kindleç¨ã®è±åè¾æ¸ãèªåçæããã«ãããã形容åè©ã®è¨³èªã®è¡¨ç¾æ¹æ³ãã¡ãã£ã¨æ¹è¯ããã¨ãã話ãè¾æ¸ãã¼ã¿ã¯ãã¡ããããã¦ã³ãã¼ãã§ããã®ã§ãèå³ãããã°ä½¿ã£ã¦ã¿ã¦ã»ããã
Kindleã®å®æ©ï¼ç¡å°ãPaperwhiteãOasisãVoyageçï¼ã§ä½¿ãããªã¼ãã³ãªè±åè¾æ¸ãä½ã£ã¦ã¿ãã以åã®è¨äºã§ç´¹ä»ããEPUBè¾æ¸ãKindleã®mobiãã©ã¼ãããã«å¤æãããã®ã§ããããã¼ã¿ã½ã¼ã¹ã«ã¯WordNetãWiktionaryãªã©ã®ãªã¼ãã³ã«ä½¿ãããã®ã使ã£ã¦ããâ¦
以åã®è¨äºã§è¿°ã¹ãããã«ãTkrzw-RPCã®ãµã¼ãã¹ã¯ã¡ãã»ã¼ã¸ãã¥ã¼ã¨ãã¦ãç¨ãããã¨ãã§ããããããããã«é²å±ããã¦ãä»»æã®ã¬ã³ã¼ãã®ç¶æ å¤åããªã¢ã«ã¿ã¤ã ã«ç£è¦ãã¦å¦çã§ããä»çµã¿ããCompareExchangeã¡ã½ããã使ã£ã¦å®è£ ããã
Goè¨èªã§ã¹ã©ã¤ã¹ãæååããã使ãããã³ã¼ãä¸ã§ã¯ã¢ãã¬ã¹ãå·§ã¿ã«é è½ããã¦ãå®å ¨ãªããã°ã©ãã³ã°ãã§ããããã«ãªã£ã¦ããããããããã¾ã«ãã¢ãã¬ã¹ã使ã£ã¦ã¦ãã¼ã¯æ§ã調ã¹ããã¨ããããããã®æ¹æ³ã«ã¤ãã¦ã¡ã¢ããã
gRPCã®éä¿¡ããSSL/TLSã®æå·åã§ä¿è·ããã¨ã¨ãã«ãã¯ã©ã¤ã¢ã³ãèªè¨¼ãX.509証ææ¸ã§è¡ããããã«ãTkrzw-RPCã®ãµã¼ãã¨ã¯ã©ã¤ã¢ã³ãã©ã¤ãã©ãªãæ¹è¯ãããgRPCã§ã¯SSL/TLSã ãã§ãªããALTSãToken-basedèªè¨¼ã使ããã®ã ããã¾ãã¯æ軽ãã¤æ´å²ã®ãããªSSâ¦
ãã¼ã¿ãã¼ã¹ã©ã¤ãã©ãªTkrzwã®gRPCãµã¼ãã¹ã«Javaã§æ¥ç¶ãã¦æä½ããããã®ã©ã¤ãã©ãªãå®è£ ãããããã«ã¦ãå½åäºå®ãã¦ããC++ãJavaãPythonãRubyãGoã®å ¨ã¦ãç¶²ç¾ ããã®ã§ãgRPCã®ã¯ã©ã¤ã¢ã³ãã©ã¤ãã©ãªãæ¸ãã¾ããæ ã¯çµäºã ããã®è¨äºã§ã¯ãç°¡åâ¦
gRPCã®Javaçã®ãã¥ã¼ããªã¢ã«ã«ã¯ãGradleã使ã£ããã«ãæ¹æ³ã ãã説æããã¦ãããJavaçéã§ã¯MavenãGradleããã«ããã¼ã«ã¨ãã¦ãã使ããã¦ããã®ã¯ç¥ã£ã¦ããããç§ã¯makeã使ãããããã£ã¦ãã¾ãã¯ãã«ããã¼ã«ã使ããã«åã ã®æé ãé²ããæ¹æ³ãâ¦
ååã®è¨äºã§ãã¡ãã»ã¼ã¸ãã¥ã¼ãå®ç¾ããããã®è¦ç´ æè¡ã«ã¤ãã¦è«ãããä»åã¯ããããå®éã«Tkrzw-RPCã®ãµã¼ãã«çµã¿è¾¼ãã§ãåæ£å¦çãè¡ããã¢ãç´¹ä»ãããGoãPythonãRubyãä¸æ°ã«åºã¦ãããå¾ãªè¨äºã ã
åç´ãªkey-valueã¹ãã¬ã¼ã¸ã§ããDBMã使ã£ã¦ã¡ãã»ã¼ã¸ãã¥ã¼ãå®ç¾ããã«ã¯ã©ãããã°ãããã¨ããæèå®é¨ãããä¸ã§ãå®è£ ããã¦ãã¾ããã¨ããä¼ç»ãååã¯ãæ©è½è¦ä»¶ã¨è¦ç´ æè¡ãæ¤è¨ããã
Tkrzw-RPCã®ã¯ã©ã¤ã¢ã³ããC++ãPythonãRubyãGoã§åºæã£ãã®ã§ãç°¡åãªæ§è½ãã¹ãããã¦ã¿ãã以ä¸ã¯1ã¹ã¬ããã®ã¹ã«ã¼ããããã°ã©ãã«ãããã®ã ãåä½ã¯QPSã
Pythonã¨Rubyã®ã¯ã©ã¤ã¢ã³ãã©ã¤ãã©ãªãæ¸ããã®ã§ã次ã¯Goã ãgRPCçéã§ã¯Goããã使ããããããªã®ã§ãåªå 度é«ãã§çæããã詳ãããã¨ã¯APIææ¸ãã覧ããã ãããããç°¡åãªä½¿ãæ¹ãããã§ãç´¹ä»ããã
Tkrzwã®Fedoraç¨ã®ããã±ã¼ã¸ãä½ã£ã¦ããã¦ãã人ããä¸å ·åå ±åãè²°ã£ã¦ããããã®ä¸å ·åã¯PowerPC 64ãããã®ç¹å®ã®ç°å¢ã§ããèµ·ãããªããããããã®ä¸å ·åãæå ã§åç¾ã§ããªãã®ã§ãä½ãåé¡ãªã®ããããããããã°ããç´ããªãã§ããããã®åå ããã£â¦
ååã®è¨äºã§Pythonã®ã¯ã©ã¤ã¢ã³ãã©ã¤ãã©ãªãç´¹ä»ããããRubyã®ã¯ã©ã¤ã¢ã³ãã©ã¤ãã©ãªãå®è£ ã§ããã®ã§ãä»åã¯ãããç´¹ä»ããã詳ãããã¨ã¯APIææ¸ãã覧ããã ãããã
DBãµã¼ãã¹ãä½ããã®ä¸é£ã®é£è¼ãçµäºããç¡äºDBãµã¼ãã¹ãå®æããã®ã§ãã¯ã©ã¤ã¢ã³ãã©ã¤ãã©ãªãä½ãæ ã«åºã¦ãããã¨ããããPythonçãã§ããã®ã§ã使ãåæãªã©ã説æããããTkrzw-RPCæ¬ä½ã«ã¤ãã¦ã¯ãã¹ã©ã¤ãã®æ¹ãã覧é ãããã
ãã¼ã¿ãã¼ã¹ãµã¼ãã®éåæã¬ããªã±ã¼ã·ã§ã³æ©è½ãå®è£ ãããããã®ãããã³ã«ã¨å®è£ ã®è©³ç´°ã«ã¤ãã¦è¿°ã¹ã¤ã¤ã妥å½æ§ã«ã¤ãã¦æ¤è¨¼ããããé常ã«ç´°ããã¦éç®±ãã¤ã¤ã話ã«ãªãããç¥ã¯å§ç´°ã«å®¿ãã¨ãè¨ããããªããããã«ã§ããªããã¨ã°ããã ã
ã¤ãã«ããã¼ã¿ãã¼ã¹ãµã¼ãTkrzw-RPCã«éåæã¬ããªã±ã¼ã·ã§ã³æ©è½ãã¤ããããã¹ã¿ã»ã¹ã¬ã¼ãæ§æã ãã§ãªãããã¥ã¢ã«ãã¹ã¿æ§æããµãã¼ããã¦ããªã³ã©ã¤ã³ã·ã¹ãã ã®ããã¯ã¨ã³ãã¨ãã¦å©ç¨ã§ããé«å¯ç¨æ§ãåããã·ã¹ãã ã«ãªã£ããTkrzw-RPC-0.9.0ãâ¦
Tkrzw-RPCã®ã¬ããªã±ã¼ã·ã§ã³æ©è½ãå®ç¾ããããã«ãTkrzwæ¬ä½ã«æ´æ°ãã°æ©è½ãã¤ãããæ´æ°ãã°æ©è½ã¯ä»»æã®ã³ã¼ã«ããã¯ãå¼ã³åºãå®è£ ã«ãªã£ã¦ãã¦ãããã«ã¡ãã»ã¼ã¸ãã¥ã¼ãæ¥ç¶ããã¨ããã«ããªã¼ãã§ä»»æã®å¾å¦çãã§ããããã«ãªããä»åã¯ãã¡ãã»â¦
ååã®è¨äºã§ãã¬ããªã±ã¼ã·ã§ã³æ©è½ã®å®è£ ãè¦è¶ãã¦ããã¼ã¿ãã¼ã¹ã®æ´æ°ãã°æ©è½ãè¨è¨ãããå®è£ ãé²ããªããæã£ãã®ã¯ããã¼ã¿ãã¼ã¹ã«æ´æ°ããã£ãæ¨ããã°ã¨ãã¦è¨é²ãã¦ãã¾ããããå¤é¨ã«éç¥ããã¨ããåä½ã¯ãã¡ãã»ã¼ã¸ãã¥ã¼ã¨åãè¦ä»¶ãæã¤â¦
ãã¼ã¿ãã¼ã¹ã®å ç¢æ§ãé«ããããã«ããã¼ã¿ãã¼ã¹æ¬ä½ã¨ã¯å¥ã«æ´æ°å 容ãä¿åãããæ´æ°ãã°ã¨ããææ³ããããããã«ãæ´æ°ãã°ãé次å¥ãµã¼ãã«è»¢éãã¦é©ç¨ããã°ãã¬ããªã±ã¼ã·ã§ã³ãæç«ããããã®è¨äºã§ã¯ãã¬ããªã±ã¼ã·ã§ã³ã«ã使ããæ´æ°ãã°ã®è¦â¦
ã·ã£ã¼ãã£ã³ã°ã«ãã£ã¦ãã¼ã¿ãã¼ã¹ãåå²ãããã¨ã§ãé常éç¨ã®ä¸¦åå¦çæ§è½ãåä¸ããããã¨ãã§ãããããã ãã§ãªããããã¯ã¢ããä½æãªã©ã®ãä»ã®ã¹ã¬ããããããã¯ããããæä½ã®å½±é¿ãæå°éã«çãããã¨ãã§ããããã®éç¨æ¹æ³ã«ã¤ãã¦èª¬æããã
GCCã®ä¸å¯è§£ãªæåã«æ©ã¾ããã¦ããã以ä¸ã®ã³ã¼ãã¯ãè² æ°ãåºåããªããã¨ãæå¾ ããããã-O2以ä¸ã®æé©åãããã¨è² æ°ãåºåããã¦ãã¾ãã #include <cstdint> #include <cstdio> int main(int argc, char** argv) { constexpr uint32_t modulo = 2039; for (int32_t i =</cstdio></cstdint>â¦
ååã®è¨äºã«ã¦ããããåã¨ã¹ããªã¼ã åã«ãã£ã¦gRPCã®æ§è½ãåä¸ãããã¨ã示ãããæ®ãé«éåã®æ段ã¯ãéåæAPIãå©ç¨ãããã¨ã§ãããçµè«ã¨ãã¦ã¯ããµã¼ãå´ã§ã¯éåæAPIãå©ç¨ããã¨æ§è½ãããªãåä¸ããããããå®è£ ããTkrzw-RPC 0.7.1ããªãªã¼ã¹â¦
ååã®è¨äºã§è¿°ã¹ãæ§è½è©ä¾¡ã«ãã£ã¦ãgRPCã«ããæä½ãåä¸ãã·ã³ä¸ãªã2ä¸QPSã®ã¹ã«ã¼ãããã§å®è¡ã§ãããã¨ãåãã£ããããã¯ãã¼ã¿ãã¼ã¹èªä½ã®æ§è½ã«æ¯ã¹ãã¨é ãããã®ã§ãããé«ãã¹ã«ã¼ããããåºããããã«gRPCã®ä½¿ãæ¹ã工夫ããããªããä»åã¯â¦