| | |
| | | var obj = document.getElementById("varHot");
|
| | |
|
| | | if(typeof(obj) == 'undefined' || obj==null || obj.value.length<=0){
|
| | | return "";
|
| | | return null;
|
| | | }
|
| | | let val = obj.value.toString();
|
| | |
|
| | |
| | | for(var i=0;i<result.length-1;i++)
|
| | | wordstr=wordstr+result[i]+" ";
|
| | |
|
| | | jsonresult[wordstr.trim()]=result[result.length-1];
|
| | | jsonresult[wordstr.trim()]= parseInt(result[result.length-1]);
|
| | | }
|
| | | }
|
| | | console.log("jsonresult="+JSON.stringify(jsonresult));
|
| | | return jsonresult;
|
| | | return JSON.stringify(jsonresult);
|
| | |
|
| | | }
|
| | | function getAsrMode(){
|
| | |
| | | {
|
| | | return tmptext;
|
| | | }
|
| | | tmptext=tmptext.replace(/。/g, ","); // in case there are a lot of "。"
|
| | | var words=tmptext.split(",");
|
| | | tmptext=tmptext.replace(/。|?|,|、|\?|\.|\ /g, ","); // in case there are a lot of "。"
|
| | | var words=tmptext.split(","); // split to chinese sentence or english words
|
| | | var jsontime=JSON.parse(tmptime); //JSON.parse(tmptime.replace(/\]\]\[\[/g, "],[")); // in case there are a lot segments by VAD
|
| | | var char_index=0;
|
| | | var char_index=0; // index for timestamp
|
| | | var text_withtime="";
|
| | | for(var i=0;i<words.length;i++)
|
| | | {
|
| | |
| | | {
|
| | | continue;
|
| | | }
|
| | | console.log("words===",words[i]);
|
| | | console.log( "words: " + words[i]+",time="+jsontime[char_index][0]/1000);
|
| | | console.log("words===",words[i]);
|
| | | console.log( "words: " + words[i]+",time="+jsontime[char_index][0]/1000);
|
| | | if (/^[a-zA-Z]+$/.test(words[i]))
|
| | | { // if it is english
|
| | | text_withtime=text_withtime+jsontime[char_index][0]/1000+":"+words[i]+"\n";
|
| | | char_index=char_index+words[i].length;
|
| | | char_index=char_index+1; //for english, timestamp unit is about a word
|
| | | }
|
| | | else{
|
| | | // if it is chinese
|
| | | text_withtime=text_withtime+jsontime[char_index][0]/1000+":"+words[i]+"\n";
|
| | | char_index=char_index+words[i].length; //for chinese, timestamp unit is about a char
|
| | | }
|
| | | }
|
| | | return text_withtime;
|
| | |
|