function AI_IOManager(env){
this.env = env;
+ this.lastSentenceSourceType = undefined;
+ // User, File, Web
}
AI_IOManager.prototype = {
//http://www.atmarkit.co.jp/ait/articles/1112/16/news135_2.html
this.sentenceList = new Array();
}
AI_Input.prototype = {
- maxHistoryLength: 16,
+ maxHistoryLength: 32,
sentenceSeparator: [
"。",
"!",
"?",
"\n",
],
- appendInput: function(input){
+ appendInput: function(input, srctype){
//inputはStringとArrayが使用できる
- var sList = input.splitByArray(this.sentenceSeparator);
-
- this.sentenceList = this.sentenceList.concat(sList)
+ var sList;
+ if(srctype != "User"){
+ sList = input.splitByArray(this.sentenceSeparator);
+ } else{
+ sList = [input];
+ }
+ //console.log(sList);
+ this.sentenceList.push([srctype]);
+ this.sentenceList = this.sentenceList.concat(sList);
},
getSentence: function(){
- //改行のみの文は破棄
for(;;){
if(this.sentenceList.length <= 0){
return undefined;
}
- var retv = this.sentenceList[0];
- this.sentenceList.splice(0, 1);
- retv = retv.trim();
- if(retv != ""){
- break;
+ var retv = this.sentenceList.shift();
+ if(retv instanceof Array){
+ //ソースタイプ変更
+ this.lastSentenceSourceType = retv[0];
+ continue;
}
+ retv = retv.trim();
+ break;
}
- //ここで単語候補抽出を行っておく
- this.env.wordRecognition.slideLookUpCandidateWordByHistory(retv);
//
+ this.env.memory.dbInfo.readLineCount++;
this.appendHistory(retv);
return retv;
},