1 function AI_IOManager(env){
3 this.lastSentenceSourceType = undefined;
6 AI_IOManager.prototype = {
7 //http://www.atmarkit.co.jp/ait/articles/1112/16/news135_2.html
8 //http://qiita.com/mohayonao/items/fa7d33b75a2852d966fc
9 showDownloadLink: function(blobData){
11 this.env.downloadBox.innerHTML = "<a href='" + window.URL.createObjectURL(blobData) + "' target='_blank'>ダウンロード</a>";
12 } else if(window.webkitURL){
13 this.env.downloadBox.innerHTML = "<a href='" + window.webkitURL.createObjectURL(blobData) + "' target='_blank'>ダウンロード</a>";
15 window.alert("Can't create URL");
20 function AI_Input(env){
22 this.historyList = new Array();
23 this.sentenceList = new Array();
25 AI_Input.prototype = {
35 appendInput: function(input, srctype){
36 //inputはStringとArrayが使用できる
38 if(srctype != "User"){
39 sList = input.splitByArray(this.sentenceSeparator);
44 this.sentenceList.push([srctype]);
45 this.sentenceList = this.sentenceList.concat(sList);
47 getSentence: function(){
49 if(this.sentenceList.length <= 0){
52 var retv = this.sentenceList.shift();
53 if(retv instanceof Array){
55 this.lastSentenceSourceType = retv[0];
62 this.appendHistory(retv);
65 appendHistory: function(str){
66 this.historyList.push(str);
67 if(this.historyList.length > this.maxHistoryLength){
68 this.historyList.splice(0, this.maxHistoryLength >> 1);