LoginSignup
4
4

More than 5 years have passed since last update.

音声認識 Julius の「認識結果」ストリングを単語配列に

Last updated at Posted at 2012-10-12

/**
*  Juliusの「認識結果」ストリングを単語配列にする
* @see http://julius.sourceforge.jp/index.php?q=doc/module.html
*/
private function juliusParser(str : String) : Array
{
        var startindex : int = str.indexOf("<RECOGOUT>");
        if(startindex== -1) return null;
        var lastindex : int = str.indexOf("</RECOGOUT>");
        if (lastindex != -1) {
            str = str.slice(startindex, lastindex + 11);
            str = str.replace(/<s>/, '');
            str = str.replace(/<\/s>/, '');
            var xml : XML = new XML(str);
            var wordLines : XMLList = xml.children().WHYPO.(@CLASSID != "");
            var wordLineNum : int = wordLines.length();
            var words : Array = [];
            for (var i : int = 0; i < wordLineNum; i++) {
                var word : String = wordLines[i].@WORD;
                words.push(word);
            }
            return words;
        }
        return null;
}
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4