å¶ç¶ä¿³å¥ãã¤ã¼ãbotã®è§£èª¬ã¨ã«ã¼ã«èª¬æãã¦ã¿ã¾ã
ä¹
ã
ã®ããã°ã§ãã
å
æ¥ãå¶ç¶ä¿³å¥ãã¤ã¼ãbotã¨ãããã®ãä½ãã¾ããã
@mazamachi ãã®ä¸ã«ä¿³å¥ãçºè¦ãã¾ããã ãæ¿é£ãã°éãé³´ããªãæ³é寺ã å£èª:æ¿(ç§)
— å¶ç¶ä¿³å¥ãã¤ã¼ãbot (@haiku_searcher) 2015, 3æ 14
ã¨ã¯è¨ã£ã¦ããbotã§ããã¤ã¼ããããããã«å 容ã¨ã¢ã¤ãã£ã¢èªä½ã¯ã¡ãã£ã¨åã«è©±é¡ã«ãªã£ãå¶ç¶çæbot(@g57577)ãããã§ä¸å¥bot(@kokodeikku_botã¨ä¸ç·ã§ããç¹ã«ããã§ä¸å¥botã«ã¤ãã¦ã¯ãtwitterãªããã以å¤ã»ã¼åããªã®ã§ãã¯ãªã¨è¨ããã¦ãããããªãããããã¾ãããããã¿ã¾ããã
ä»åã¯ãã¡ãã®ã¾ã¨ãã¦ããã ããtogetterâãããªãbuzzã£ãããã§ãããªããã©ãã¼ãã¦ããã ãã¾ããã
ã¤ã¶ããããäºä¸äºãæ¤åºãã¦å ±åãã¦ããå¶ç¶ä¿³å¥botã¨ã®æ¦ã - Togetterã¾ã¨ã
æå¾
ãã¦ãã©ãã¼ãã¦ããã ãã¦å¬ããã®ã§ããããã©ãã¼ãã¦ããã ããã ãã§ã¯ä¿³å¥ãæ¢ç´¢ããªãã®ã§ãbotããã©ããããã¾ã§å°ã
ãå¾
ã¡ãã ããã
ã¾ãããã©ãã¼ãå¢ããããããé »ç¹ã«è¦å¶ããããåå¾æ¼ããèµ·ããããã¦ãããããªã®ã§ãæ®éã«ä¿³å¥ããã¤ã¼ãããã¦ãéç¥ã§ããªããã¨ãå¤ãããã§ãããäºæ¿ãã ããã
ã©ãããåºæºãä»çµã¿ã§ä¿³å¥ãæ¢ç´¢ãã¦ããã®ãåãããªãã¨ããè¨ããã¦ãããããªã®ã§ãããã§ã«ã¼ã«ã¨ä»çµã¿ãç°¡åã«è§£èª¬ãã¦ããã¾ãã
åºæ¬ã«ã¼ã«
æç« ã®è§£æã¯mecab+IPAè¾æ¸
å½¢æ
ç´ è§£æã«ã¯mecabã¨IPAè¾æ¸ãå©ç¨ãã¦ãã¾ããã¨è¨ã£ã¦ãä½è¨ã£ã¦ããããããªãæ¹ãå¤ããã¨æãã¾ããã端çã«è¨ãã¨æç« ã解æãã¦ãããã½ããçãªãã®ã使ã£ã¦ããããã§ããå
·ä½çã«ã¯å
¬å¼ãµã¤ããè¦ã¦ããã ããã¨åããããããã¨æãã¾ãã
MeCab: Yet Another Part-of-Speech and Morphological Analyzer
ä¾ãã°ããæ¿é£ãã°éãé³´ããªãæ³é寺ãã¨ãããã®ãmecabãç¨ãã¦è§£æããã¨
æ¿ åè©,ä¸è¬,*,*,*,*,æ¿,ã«ã,ã«ã é£ã åè©,èªç«,*,*,äºæ®µã»ã¯è¡ä¿é³ä¾¿,ä»®å®å½¢,é£ã,ã¯ã¨,ã¯ã¨ ã° å©è©,æ¥ç¶å©è©,*,*,*,*,ã°,ã,ã é åè©,ä¸è¬,*,*,*,*,é,ã«ã,ã«ã ã å©è©,æ ¼å©è©,ä¸è¬,*,*,*,ã,ã¬,㬠鳴ã åè©,èªç«,*,*,äºæ®µã»ã©è¡,åºæ¬å½¢,é³´ã,ãã«,ãã« ãªã å©è©,æ¥ç¶å©è©,*,*,*,*,ãªã,ããª,ã㪠æ³é寺 åè©,åºæåè©,çµç¹,*,*,*,æ³é寺,ãã¦ãªã¥ã¦ã¸,ãã¼ãªã¥ã¼ã¸
ã¨ããããã«è§£æãã¦ãããããã§ããããããã®å解ããè¦ç´ ã®æå¾ã«ãã®è¨èã®èªã¿ãããã®ã§ããããå©ç¨ããã°575ã®ãªãºã ã«ãªã£ã¦ãããã®ãè¦ã¤ããããã°ã©ã ãä½ããããã§ãã
ã¡ãªã¿ã«åã¯mecabã使ã£ã¦ã¿ãã®ã¯ãããåãã¦ã§ãç·´ç¿ã®ããã«ä½ã£ã¦ã¿ãã®ããã®botã ã£ãããã¾ãã
é³ã®ã«ã¼ã«
- ãããã ãããã ããã¯å ¨é¨0é³æç®(ãããããªã©ã¯1é³)
- ãã¼ããã£ãã¯ä¸é³
- èªã¿æ¹ãããããªãè¨è(è±åèªãè¨å·ãªã©)ãå«ã¾ãããã®ã¯å¤å®ããªã
- åä½ãã¯NG
åä½ãã«ã¤ãã¦ã¯ã許容ãã¦ãã¾ãã¨ããªãã®æç« ã俳å¥èªå®ããã¦ãã¾ããããæ®å¿µãªããNGã¨ãã¾ããã
ä»ã¯å²ã¨è´å½çãªãã°ãããã®ã§ããã®ãã¡ä¿®æ£ãã¾ãã(å°å£°)
ã¾ããåã¯ä¿³å¥ã«ã¤ãã¦ç¥èãå
¨ç¶ç¡ãã®ã§ãªããããããæãããã°æãã¦ãã ããâ¦
ä¸/ä¸/ä¸ã®å¥ã®æåã®åèªã®ã«ã¼ã«
俳å¥ã®æåã®åèªã®åè©ã¨ãã¦OKãªã®ã¯ã
[åè©,åè©,形容è©,形容åè©, å¯è©, é£ä½è©, æ¥ç¶è©, æåè©, æ¥é è©, ãã£ã©ã¼]
ã®ã©ããã§ãã
ããã«ãæåã®åèªã®ç´°ããã«ã¼ã«ã¨ãã¦ã
- éèªç«åè©ãæ¥å°¾èªã¯NG
- ããããªã©å°ããæåããå§ã¾ãã®ã¯NG
ã¨ãããã®ãããã¾ãã
ä¾ãã°ãã¿ããé£ã/ã°éãé³´ããª/æ³é寺ãã¿ãããªã®ã¯ä¸ã®å¥ãå©è©ããå§ã¾ã£ã¦ãã®ã§ãã¡ã£ã¦ãã¨ã§ãã
ä¸/ä¸/ä¸ã®å¥ã®æå¾ã®åèªã®ã«ã¼ã«
- æ¥é è©ã¯NG
ä»ã®ã¨ããããã ãã§ãã
ä¾ãã°ãã¡ãã£ã¨ã¾ã¦/ã¡ãã£ã¨ã¾ã£ã¦ã/ãã«ããããã¯OKã§ãããã¡ãã£ã¨ã¾ã¦/ã¡ãã£ã¨ã¾ã£ã¦ã/ã«ããã¼ããã¯æ¥é è©ããããä¸ã®å¥ã®æ«å°¾ã«æ¥ã¦ããã®ã§NGã¨ãããã¨ã§ãã
ä¸ã®å¥ã®æå¾ã®åèªã®ã«ã¼ã«
- æ´»ç¨èªã®å ´åãçµæ¢å½¢ã®ã¿
è¦ããã«ãé£ç¨æ¢ãªã©ãç¦æ¢ããããã§ãã
å
¨ä½çã«å²ã¨å³ããã«ã¼ã«ãé©ç¨ãã¦ããã®ã§ãããããã¯ã«ã¼ã«ãç·©ãããã¨ã©ãè¦ã¦ã575ãããªããã®ã¾ã§575ã¨èªå®ãã¦ãã¾ããã¡ã§ãããã«ãã¤ã¼ãæ°ãå¢ããã¨è¦å¶ã«ã¤ãªããããããªãããã§ããæåã¯ãã£ã¨ã¶ã«ã ã£ããã§ããããªãã«ããææã«å¯¾å¿ãã¦ããã大å精度ãä¸æãã¾ãããããã°ãã¼ã¿ã£ã¦åã(ï¼)ã
å£èªå¤å®
ã©ãã«ããã¦ããã§ä¸å¥botã¨å·®å¥åãããã¨æã£ãè¦èã®çããã¡ãã®å£èªå¤å®ã«ãªãã¾ãã
ãæ°ã¥ãã®æ¹ãå¤ãã¨æãã¾ãããå£èªã¯èªã¿ã®é³ã«ãã£ã¦å¤å®ãã¦ãã¾ããããã¯æè©ã«å¯¾å¿ããããã§ãããã¡ããåã§ãã
ããããªãé³ã§å¤å®ãã¦ãããã¨ããã¨ãæ®éã«åèªã§å¤å®ãããã¨æãã¨æ»
å¤ã«å£èªããªããªã£ã¦ãã¾ããã¤ã¾ããªãããã§ããç°è«ã¯èªãã¾ããã
å£èªã«ã¤ãã¦ã¯現代俳句データベースãªã©ãããåããã¾ãããç¾å¨2529åã®å£èªãç»é²ããã¦ãã¾ãã
ã¡ãªã¿ã«ãã¸ã§ã¬ã¼ã»ãã¼ãã¼(å¬)ã¨ãããããããªã®ã§ããããå«ã俳å¥ãã§ããã®ã楽ãã¿ã«ãã¦ã¾ãã
å³ãªãã®ä»çµã¿
ã©ãããç§éãªããåãã¦ãããããªã®ã§ã¡ãã£ã¨è§£èª¬ãã¦ããã¾ãããå®ã¯ããèªä½ã¯ããã»ã©é£ãããã¨ããã¦ãã¾ããã
ã¨ããã®ããTwitterã«ã¯Streaming APIã¨ãããã®ããããä¾ãã°echofonãªã©ã®ã¢ããªã§ã¯ãæµãã¦ããæ
å ±(ãã¤ã¼ã)ããã¢ã¤ã³ã³ç»åã¨ã¦ã¼ã¶ã¼åããã¤ã¼ãå
容ã ãåãåºãã¦ä¸ã¤ã®ããã¤ã¼ããã¨ãã¦è¡¨ç¤ºãã¦ããããã§ããã ããä¸ã
ãã¼ãããå¿
è¦ããªããããã¤ã¼ãããã¦ãã表示ããã¦ããããã§ããã
å½botã§ã¯ãã®Streaming APIãå©ç¨ããæµãã¦ãããã¤ã¼ããããã¤ã¼ãå
容ãåãåºãã俳å¥èªå®ã¨å£èªæ¢ç´¢ããã¦ãã¤ã¼ããã¦ã¾ãã
ã¡ãªã¿ã«ç¾ç¶ã§ã¯ãã¤ã¼ãå
容ãã俳å¥ãæ¢ããå£èªèªå®ãããã®ã«ç´0.5ç§ããã¤ã¼ãããã®ã«ç´0.3ç§ã®è¨0.8ç§ãããã£ã¦ãã¾ã£ã¦ããã®ã§ãæãããã°å°ãé«éåããããã¨æã£ã¦ãã¾ãã
æå¾ã«
å°ã解説ããã¦ããã ãã¾ããããåãããããã§ä¸å¥botãå¶ç¶çæbotã®ä½è
ããã®æ¹ãæ©è½ã精度ãè¯ãã®ã§ããã¡ããè¦ã¦ããã ããã¨å¬ããã§ãã
Ruby - Slackの会話を元に一句詠む - Qiita
形態素解析エンジンMeCabにて文章中から短歌を抽出 - inaniwa3's blog
æ°ããæ©è½ã追å ãããã¨éæåªåãã¦ããã®ã§ãããä»æã¯è¥å¹²å¿ããã®ã§æ°ã¾ã¾ã«ãå¾ ã¡æ´ããã¨å¹¸ãã§ãã
以ä¸ãåèæç®ã§ãã
現代俳句データベース
MeCab: Yet Another Part-of-Speech and Morphological Analyzer
ãæ±äº¬é½çå½èªä¾¿è¦§ãæµå³¶æ¸åº