ã¯ããã«
前回ãiRemocon ãæä½ããã¨ããã¾ã§ããã¾ããï¼ä¸èº«ã¯ãã ã® telnet ã¿ãããªããã§ããâ¦ï¼ã
次ã¯ãã¤ã¯ã§åã£ãè¨èãæ¾ã£ã¦ããã«å¾ã£ã¦æä½ãåºæ¥ãããã«ãããã¨æãã¾ãããã®ã¨ã³ããªã§ã¯é³å£°èªèããçµæã C++ ã§åã£ã¦ããã¨ããã¾ã§ããã¾ãã
ã§ãããªã¼ã®é³å£°èªèã¨ã³ã¸ã³ããªããã¨æ¢ãã¦ã¿ãã¨ãããJulius ã«ç½ç¾½ã®ç¢ãç«ã¡ã¾ããã
é³å£°èªèåéã®çéã§ã¯æåãããã§ãããåãããªãç¹ãå¤ãã£ãã®ã§ã¼ããã¦ãããè²ã ãªæ¹ã«å©è¨ãããã ãã¦ãä½ã¨ãåãããã¨ãã§ãã¾ããããããã¨ããããã¾ãï¼
Juliusã®ã¤ã³ã¹ãã¼ã«ã¨åä½ãã¹ã
- The Julius book
- 音声認識システム Julius を使って twitter に投稿する ruby スクリプト - Moderation is a fatal thing. Nothing succeeds like excess.
ããããåèã«ãªãã¾ããã精度ãã¡ãã£ã¨ã ãä¸ãããã£ãã®ã§ configure ã®ãªãã·ã§ã³ãä»ãã¦ããã¾ããã
cvs -z3 -d:pserver:[email protected]:/cvsroot/julius co julius4 cd julius4 ./configure --enable-setup make
åããããããã§ã³ã³ãã¤ã«å®äºãconfigure ã®ãªãã·ã§ã³ã¯ãã£ã¨ãããã°ã精度ãè¯ããªãããããã¾ããã
次ã«ä»¥ä¸ã®ãã¼ã¸ãããã£ã¯ãã¼ã·ã§ã³ããããè½ã¨ãã¦ãã¦è§£åãã¾ãã
åºæ¥ã fast.jconf ã ããã£ãã® julius ã®ãã©ã«ãã«çªã£è¾¼ãã§ããã¾ãã
./julius/julius -C fast.jconf -input mic -charconv EUC-JP UTF-8
ããã§èµ·åããã¨ã
<<< please speak >>>
ã¨èãããã®ã§åãã°èªèããçµæã表示ããã¾ãã
pass1_best: ãã¬ããã¤ãã¦ã sentence1: ãã¬ããã¤ãã¦ã
Juliusããµã¼ãã¢ã¼ãã§åãã
ã-module ãªãã·ã§ã³ãä»ã㦠julius ãèµ·åããã¨ãµã¼ãã¢ã¼ãã§ç«ã¡ä¸ãã£ã¦ãå¾ã¯ 10500 ãã¼ã㨠TCP/IP ã§éä¿¡ããã°çµæã XML ã§è¿ã£ã¦ãã¾ããããããã¼ã¹ããã°ææã®çµæãå¾ãããããã§ãã
ãµã¼ãå´
./julius/julius -C fast.jconf -input mic -charconv EUC-JP UTF-8 -module
ã¯ã©ã¤ã¢ã³ãå´
hecomi@hecominote:~/Program/cpp/iRemocon$ telnet 192.168.0.10 10500 Trying 192.168.0.10... Connected to 192.168.0.10. Escape character is '^]'. <STARTPROC/> . <INPUT STATUS="LISTEN" TIME="1326295699"/> . <INPUT STATUS="STARTREC" TIME="1326295701"/> . <STARTRECOG/> . <INPUT STATUS="ENDREC" TIME="1326295703"/> . <ENDRECOG/> . <INPUTPARAM FRAMES="140" MSEC="1400"/> . <RECOGOUT> <SHYPO RANK="1" SCORE="-3549.973877"> <WHYPO WORD="" CLASSID="<s>" PHONE="silB" CM="0.914"/> <WHYPO WORD="å æ°" CLASSID="å æ°:ã²ã³ã:å æ°:509" PHONE="g e N k i" CM="0.410"/> <WHYPO WORD="ã" CLASSID="ã:ã²:ã:63" PHONE="o" CM="0.928"/> <WHYPO WORD="ã¤ã" CLASSID="ã¤ã:ãã±:ã¤ãã:239" PHONE="ts u k e" CM="0.468"/> <WHYPO WORD="ã¦" CLASSID="ã¦:ã:ã¦:68" PHONE="t e" CM="0.638"/> <WHYPO WORD="ã" CLASSID="ã:ã:ã:8" PHONE="sp" CM="0.546"/> <WHYPO WORD="" CLASSID="</s>" PHONE="silE" CM="1.000"/> </SHYPO> </RECOGOUT> . <INPUT STATUS="LISTEN" TIME="1326295703"/> . Connection closed by foreign host.
ãã¼ãâ¦ãé»æ°ãã¤ãã¦æ¬²ããã£ããã ãã©â¦ã
æ»èãæªãã®ãããããªãã§ãããã¾ãã¾ãèªèãã¦ããã¾ãã
C++ ã§æååã«å¤æ
次ã®ãããªããã°ã©ã ãã¯ã©ã¤ã¢ã³ãã¨ãã¦æ¸ãã¾ããã
ã³ã¼ã
#include <iostream> #include <boost/regex.hpp> #include <boost/asio.hpp> int main(int argc, char const* argv[]) { using namespace boost::asio; using namespace std; // Julius ã® ip 㨠port ãæå® const std::string ip = "192.168.0.10"; const int port = 10500; // Julius ã¸æ¥ç¶ ip::address addr = ip::address::from_string(ip); ip::tcp::endpoint ep(addr, port); ip::tcp::iostream s(ep); // Julius ãµã¼ã èµ·å s << "STATUS\n" << std::flush; // å¿çã解æããæ£è¦è¡¨ç¾ boost::regex r("WORD=\"([^\"]+)\""); boost::smatch m; // Julius ããã®å¿çã解æ string line, word; while (getline(s, line)) { if (boost::regex_search(line, m, r)) word += m.str(1); else if (line.find("<RECOGOUT>") != npos) word = ""; else if (line.find("</RECOGOUT>") != npos) cout << word << endl; } return 0; }
ã³ã³ãã¤ã«
g++-4.6 julius_client.cpp -o julius_client -lboost_system -lboost_thread -lpthread -lboost_regex
çµæ
ãµã¼ããåãããå¾å®è¡ãã¦ãªã«ãããã¹ã£ã¦ã¿ã¾ãã
åãã¤ãã¦ã å¶å©ãæãã¦ã 人æ°ãã¤ãã¦ã é»æ°ãã¤ãã¦ã å¹³åãæãã¦ã ãã«æ¾æ£ãã¦ã ä½ã«ãæ¥ã¦ã æ°ã«ç½®ããã¦ããã ãã¬ããåãä»ããã ç 究ã å æ°ãã æ¥è¨ãã¤ãã¦ã åãã¤ãã¦ã Aï¼ãã¤ãã¦ã ãã æ´åã ï¼§ï¼¥ï¼´ï¼ ãæ°ã«å ¥ãã ãã¼ããå æ°ãã¤ãã¦ã ãã ãã¬ããã¤ãã¦ã å強決ã㦠é»æ°ãæ¶ã
çµè«
ãã¾ã«ããæåããªãï¼#^Ï^ï¼ï¾ï¾ï½·ï¾ï¾ï½·
ããããé å¼µãã¨ç²¾åº¦è¯ããªããï¼ã¨ã®æ
å ±ãé ããã®ã§é å¼µã£ã¦ã¿ã¾ãã
次ã¯å¾ãé³å£°èªèçµæã iRemocon ã«éãã¨ãããä½ãããã¨æãã¾ãã