OSDN Git Service

AI_DatabaseInfoTagを追加。
[chnosproject/AI004.git] / aisub.js
index c913029..0c7e60a 100644 (file)
--- a/aisub.js
+++ b/aisub.js
@@ -1,5 +1,7 @@
 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
@@ -21,7 +23,7 @@ function AI_Input(env){
        this.sentenceList = new Array();
 }
 AI_Input.prototype = {
-       maxHistoryLength: 16,
+       maxHistoryLength: 32,
        sentenceSeparator: [
                "。",
                "!",
@@ -30,28 +32,34 @@ AI_Input.prototype = {
                "?",
                "\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;
        },