var words = {}; words['v'] = {}; words['n'] = {}; words['aj'] = {}; words['ad'] = {}; words['v_v'] = {}; var vPatterns = []; vPatterns.push({grammar:['gen'],name:'SVi',val:[{type:'el',eltype:'V',be:false}]}); vPatterns.push({grammar:['be'],sposition:true,Stype:'a_n',the:false,name:'ThereBe',val:[{type:'w',pos:'cst',val:'there',progressive:false},{type:'el',eltype:'V',be:true},{type:'el',eltype:'S'}]}); vPatterns.push({grammar:['gen'],sposition:true,Stype:'a_n',the:false,name:'ThereVi',val:[{type:'w',pos:'cst',val:'there'},{type:'el',eltype:'V',be:false,progressive:false},{type:'el',eltype:'S'}]}); vPatterns.push({grammar:['gen','inf'],sInherit:true,sposition:true,Stype:'a_n',the:false,name:'ThereViToBe',val:[{type:'w',pos:'cst',val:'there'},{type:'el',eltype:'V',be:false,progressive:false},{type:'vp',Vform:'inf',son:false,be:true,have:false,progressive:false,passive:false,past:false,vpname:['SBeC']}]}); vPatterns.push({grammar:['gen','that'],sposition:true,name:'ItVThat',val:[{type:'w',pos:'cst',val:'it'},{type:'el',eltype:'V',be:false,third:3,isPlural:false},{type:'vp',Vform:'that'}]}); vPatterns.push({grammar:['be','c'],name:'SBeC',val:[{type:'el',eltype:'V',be:true},{type:'el',eltype:'C',Ctype:['a_n','pn','ipn','aj']}]}); vPatterns.push({grammar:['gen','aj'],name:'SViAj',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'C',Ctype:'aj'}]}); vPatterns.push({grammar:['gen','aj','that'],name:'SViAjThat',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'C',Ctype:'aj'},{type:'vp',Vform:'that'}]}); vPatterns.push({grammar:['gen','c'],name:'SLvC',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'C',Ctype:['a_n','pn','ipn','aj'],vpInherit:true}]}); vPatterns.push({grammar:['gen','inf'],name:'SLvtoInf',val:[{type:'el',eltype:'V',be:false},{type:'vp',Vform:'inf',son:false}]}); vPatterns.push({grammar:['be','inf'],name:'SBetoInf',val:[{type:'el',eltype:'V',be:true,modal:false,have:false,progressive:false},{type:'vp',Vform:'inf',son:false}]}); vPatterns.push({grammar:['gen'],name:'SVN',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'}]}); vPatterns.push({grammar:['gen','that'],name:'SVThat',val:[{type:'el',eltype:'V',be:false},{type:'vp',Vform:'that'}]}); vPatterns.push({grammar:['gen','that'],name:'SVItThat',val:[{type:'el',eltype:'V',be:false},{type:'w',pos:'cst',val:'it'},{type:'vp',Vform:'that'}]}); vPatterns.push({grammar:['gen','ger'],name:'SVIng',val:[{type:'el',eltype:'V',be:false},{type:'vp',Vform:'ger',son:false}]}); vPatterns.push({grammar:['gen','inf'],name:'SVInf',val:[{type:'el',eltype:'V',be:false},{type:'vp',Vform:'inf',son:false}]}); vPatterns.push({grammar:['gen','inf'],name:'SVBase',val:[{type:'el',eltype:'V',be:false},{type:'vp',Vform:'base',son:false}]}); vPatterns.push({grammar:['gen','wh'],name:'SVWh',val:[{type:'el',eltype:'V',be:false},{type:'vp',Vform:'wh',son:false}]}); vPatterns.push({grammar:['gen'],name:'SVDOToIO',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'w',pos:'pre',base:'to'},{type:'el',eltype:'O'}]}); vPatterns.push({grammar:['gen'],name:'SVDOForIO',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'w',pos:'pre',base:'for'},{type:'el',eltype:'O'}]}); vPatterns.push({grammar:['gen','that'],sposition:true,name:'ItVOThat',val:[{type:'w',pos:'cst',val:'it'},{type:'el',eltype:'V',be:false,third:3,isPlural:false},{type:'el',eltype:'O'},{type:'vp',Vform:'that'}]}); vPatterns.push({grammar:['gen','wh_inf'],name:'SVWhInf',val:[{type:'el',eltype:'V',be:false},{type:'vp',Vform:'wh_inf',son:false}]}); vPatterns.push({grammar:['gen'],name:'SVIODO',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'el',eltype:'O'}]}); vPatterns.push({grammar:['gen','that'],name:'SVIOThat',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'vp',Vform:'that'}]}); vPatterns.push({grammar:['gen','wh'],name:'SVToIOWh',val:[{type:'el',eltype:'V',be:false},{type:'w',pos:'pre',base:'to'},{type:'el',eltype:'O'},{type:'vp',Vform:'wh'}]}); vPatterns.push({grammar:['gen','that'],name:'SVToIOThat',val:[{type:'el',eltype:'V',be:false},{type:'w',pos:'pre',base:'to'},{type:'el',eltype:'O'},{type:'vp',Vform:'that'}]}); vPatterns.push({grammar:['gen','that','inf'],name:'SVToIOInf',val:[{type:'el',eltype:'V',be:false},{type:'w',pos:'pre',base:'to'},{type:'el',eltype:'O'},{type:'vp',Vform:'inf'}]}); vPatterns.push({grammar:['gen','wh_inf'],name:'SVIOWhInf',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'vp',Vform:'wh_inf',son:false}]}); vPatterns.push({grammar:['gen','wh'],name:'SVIOWh',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'vp',Vform:'wh',son:false}]}); vPatterns.push({grammar:['gen','inf'],name:'SVOBase',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'vp',Vform:'base',son:false,have:false,be:false,progressive:false,passive:false}]}); vPatterns.push({grammar:['gen','inf'],name:'SVIOToInf',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'vp',Vform:'inf',son:false}]}); vPatterns.push({grammar:['gen','ing'],name:'SVOIng',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'vp',Vform:'ing',son:false,have:false,progressive:false}]}); vPatterns.push({grammar:['gen','aj'],name:'SVOAj',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'C',Ctype:'aj'}]}); vPatterns.push({grammar:['gen','aj','that'],name:'SVItAjThat',val:[{type:'el',eltype:'V',be:false},{type:'w',pos:'cst',val:'it'},{type:'C',Ctype:'aj'},{type:'vp',Vform:'that'}]}); vPatterns.push({grammar:['gen'],name:'SVON',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'el',eltype:'C',Ctype:['a_n']}]}); vPatterns.push({grammar:['gen','pp'],name:'SVOPp',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'vp',Vform:'pp',son:false,have:false,be:false,progressive:false,passive:false}]}); vPatterns.push({grammar:['gen','inf'],name:'SVIOToBe',val:[{type:'el',eltype:'V',be:false},{type:'el',eltype:'O'},{type:'vp',Vform:'inf',son:false,be:true,have:false,progressive:false,passive:false,past:false,vpname:['SBeC',]}]}); var pNames = { 'SVi':'S Vi', 'ThereBe':'there Be', 'ThereVi':'there Vi', 'ThereViToBe':'there Vi to-Be', 'ItVThat':'it V That-cl', 'SBeC':'S Be C', 'SLvtoInf':'S Lv to-Inf', 'SBetoInf':'S Be to-Inf', 'SVN':'S V N-ph', 'SVThat':'S V That-cl', 'SVItThat':'S V it That-cl', 'SVIng':'S V Ger', 'SVInf':'S V to-Inf', 'SVWh':'S V Wh-cl', 'SVDOToIO':'S V DO to-IO', 'SVDOForIO':'S V DO for-IO', 'ItVOThat':'it V DO That-cl', 'SVWhInf':'S V Wh-Inf', 'SVIODO':'S V IO DO', 'SVIOThat':'S V IO That-cl', 'SVToIOWh':'S V to-IO Wh-cl', 'SVToIOThat':'S V to-IO That-cl', 'SVIOWhInf':'S V IO Wh-Inf', 'SVIOWh':'S V IO Wh-cl', 'SVOBase':'S V DO Inf', 'SVIOToInf':'S V DO to-Inf', 'SVOIng':'S V DO V-ing', 'SVOAj':'S V DO Adj', 'SVON':'S V DO N-ph', 'SVOPp':'S V DO V-ed', 'SVIOToBe':'S V IO to-Be', 'SLvC':'S Lv C', 'SViAj':'S Vi Adj', 'SViAjThat':'S Vi Adj That-cl', 'SVBase':'S V Inf', 'SVToIOInf':'S V to-IO to-Inf', 'SVItAjThat':'S V it Adj That-cl'}; var u = undefined; var defdeep = 3; var nPpl = [1,2,3]; var etypes = ['w','c','vp','sv','el']; var eltypes = ['V','S','O','C','A']; var svtypes = ['to','ger','sent']; var ctypes = ['a_n','comp']; var poss = ['v','pn','n','have','m','be','gen','aj','ad','pre','cj','ij','ipn','a','wh']; var whs = ['what','why','who','whom','how','which','where','when','if','wheather']; var setforms = ['base','past','perfect','ing','three']; var vforms = ['base','present','past','perfect','ing']; var Vforms = ['sent','inf','ger','ing','pp','wh_inf','question','wh_question','order']; var prplaces = ['i','my','me','mine','myself']; var nforms = ['singular','plural']; var ajforms = ['base','more','most']; var compForms = ['base','asas','more','most']; var ntypes = ['ppl','anm']; var modals = ['will','would','can','could','must','may','might','shall','should','ought to','need','used to','had better']; var preps = ["in",'out','under','out of','on','to','for','of']; var cjs = ["when",'if','and','but']; var ijs = ["wow",'oh','yeah']; var Stypes = ['a_n','pn','ipn']; var Vtypes = ['v']; var Ctypes = ['a_n','pn','ipn','aj']; var wordmap = {}; var wordIdMap = {}; var vpmap = {}; var vpIdMap = {}; var vpNameMap = {}; var gramap = {}; var allVp = []; var incVps = []; var isOs = []; var allGrammar = []; var cmpTypes = ['ad','aj']; var begen = {'be|gen':['be','gen'],'c':['pn','a_n','ipn','aj']}; var attributes = {}; attributes['e'] = { type:['array',etypes], level:['def',0], deep:['def',defdeep]}; attributes['w'] = { pos:['array',poss], type:'w', level:['def',0], deep:['def',defdeep]}; attributes['el'] = { eltype:['array',eltypes], type:'el', level:['def',0], deep:['def',defdeep]}; attributes['c'] = { ctype:['array',ctypes], type:'c', position:['def','none'], level:['def',0], deep:['def',defdeep]}; attributes['vp'] = { type:'vp', level:['def',0], deep:['def',defdeep], accord:true, son:true, be:true, have:true, progressive:true, passive:true, past:true, modal:true, byon:true, thatoff:true, tobeoff:true, ornotoff:true, negative:true, shortN:true, Vform:['array',Vforms], vform:['array',vforms], sInherit:['def',false], level:['def',0], deep:['def',defdeep], vpInherit:['def',false], noComp:['def',false], vpname:['def',allVp], vpFilter:['def',[]], sposition:['def',u], Stype:['def',u], nBaseId:['def',u], ajBaseId:['def',u], vElems:['def',[]], oIndexes:['def',[]], oIndex:['def',u], vIndex:['def',u], cIndex:['def',u], pattern:function(obj){ obj.level++; if(!isArray(obj.vpname)){ var ovp = obj.vpname; obj.vpname = []; obj.vpname.push(ovp);}if(obj.Vform != 'sent'){ obj.vpFilter.push2(['ThereVi','ThereViToBe','ItVThat','SBetoInf','ThereBe'],[0,1,2,3]);}if(obj.deep < obj.level){ obj.vpFilter.push2(incVps);}obj.vpname = filter(obj.vpname,obj.vpFilter.unique()); if(obj.vpname.length == 0){ obj.vpname = allVp.rand();}else{ obj.vpname = obj.vpname.rand();}obj.pattern = clone(vPatterns[vpmap[obj.vpname]]); if(uif(obj.pattern.sposition)){ obj.sposition = true;}else{ obj.sposition = false;}}, s:function(obj){ if(obj.Stype != u && isArray(obj.Stype)){ obj.Stype = obj.Stype.rand();}var tempS = {type:'el',eltype:'S'}; inherit(tempS,obj,['the','Stype','level','deep']); inherit(tempS,obj.pattern,['the','Stype']); inherit(obj,obj.pattern,['the','Stype']); if(obj.nBaseId != u && ((obj.pattern.oIndexes.length==0&&obj.pattern.cIndexes.length==0) || (obj.passive || tf()))){ inherit(tempS,obj,['nBaseId']); tempS.Stype = 'a_n';}else if(obj.nBaseId != u){ var tempPos = obj.pattern.oIndexes.merge(obj.pattern.cIndexes,true); obj.oInherit = true; obj.nPosition = tempPos.rand();}obj.s = new e(tempS);}, by:function(obj){ var tempS = {type:'c',ctype:'a_n'}inherit(tempS,obj,['level','deep']); obj.by = new e(tempS);}}attributes['sv'] = { svtype:['array',svtypes], level:['def',0], deep:['def',defdeep], son:true, negative:true, have:true, progressive:true, passive:true, past:true, modal:true, type:'sv'}attributes['V'] = { eltype:'V', have:true, level:['def',0], deep:['def',defdeep], progressive:true, passive:true, past:true, modal:true, type:'el', shortN:true, negative:true, vform:['array',vforms], be:true, isPlural:true, third:['array',nPpl], Vtype:['array',Vtypes]}attributes['S'] = { eltype:'S', type:'el', Stype:['array',Stypes], deep:['def',defdeep], level:['def',0], nBaseId:['def',u]}attributes['O'] = { eltype:'O', type:'el', Otype:['array',Stypes], deep:['def',defdeep], level:['def',0], nBaseId:['def',u]}attributes['C'] = { eltype:'C', type:'el', Ctype:['array',Ctypes], deep:['def',defdeep], level:['def',0], nBaseId:['def',u], ajBaseId:['def',u]}attributes['A'] = { eltype:'A', type:'el', deep:['def',defdeep], level:['def',0]}attributes['v_v'] = { ctype:'v_v', type:'c', vform:['array',vforms], be:true, isPlural:true, third:['array',nPpl], vltype:['def','none'], middle:['def',false], vpname:['def',u], deep:['def',defdeep], level:['def',0]}; attributes['a_n'] = { ctype:'a_n', type:'c', the:['def',u], Stype:['def',u], third:['def',u], isPlural:['def',u], deep:['def',defdeep], level:['def',0], nBaseId:['def',u]}; attributes['comp'] = { ctype:'comp', type:'c', cmpType:['array',cmpTypes], cmpForm:['array',compForms], vpname:['def',u], deep:['def',defdeep], level:['def',0], ajBaseId:['def',u]}; attributes['a'] = { the:true, type:'w', pos:'a', deep:['def',defdeep], level:['def',0], n:function(obj){ var tempE = {type:'w',pos:'n'}; inherit(tempE,obj,['deep','level']); obj.n = new e(tempE);}}attributes['cst'] = { type:'w', pos:'cst', deep:['def',defdeep], level:['def',0]}attributes['ad'] = { type:'w', pos:'ad', position:['def','none'], adform:['array',ajforms], level:['def',0], deep:['def',defdeep]}attributes['aj'] = { type:'w', pos:'aj', position:['def','none'], ajform:['array',ajforms], level:['def',0], deep:['def',defdeep], ajBaseId:['def',u]}attributes['wh'] = { type:'w', pos:'wh', noO:['def',u], val:['def',u], level:['def',0], deep:['def',defdeep]}attributes['n'] = { isPlural:true, nBaseId:['def',u], pn:function(obj){ var tempE = {type:'w',pos:'pn',plural:obj.isPlural,ntype:obj.ntype,third:3}; inherit(tempE,obj,['deep','level']); obj.pn = new e(tempE); obj.i = obj.pn.i;}, type:'w', pos:'n', position:['def','none'], level:['def',0], deep:['def',defdeep]}; attributes['m'] = { pos:'m', type:'w', base:['array',modals], level:['def',0], deep:['def',defdeep]}; attributes['pre'] = { pos:'pre', type:'w', base:['array',preps], level:['def',0], deep:['def',defdeep]}; attributes['cj'] = { pos:'cj', type:'w', base:['array',cjs], level:['def',0], deep:['def',defdeep]}; attributes['ij'] = { pos:'ij', type:'w', base:['array',ijs], level:['def',0], deep:['def',defdeep]}; attributes['have'] = { pos:'have', type:'w', vform:['array',vforms], be:['def',false], isPlural:true, third:['array',nPpl], vltype:['def','have'], level:['def',0], deep:['def',defdeep]}; attributes['be'] = { type:'w', pos:'be', vform:['array',vforms], be:['def',true], isPlural:true, third:['array',nPpl], vltype:['def','none'], vpname:['def',u], level:['def',0], deep:['def',defdeep]}attributes['gen'] = { pos:'be', type:'w', vform:['array',vforms], be:['def',false], isPlural:true, third:['array',nPpl], vltype:['def','none'], vpname:['def',u], level:['def',0], deep:['def',defdeep]}attributes['v'] = { pos:'v', type:'w', vform:['array',vforms], be:true, isPlural:true, third:['array',nPpl], vltype:['def','none'], level:['def',0], deep:['def',defdeep]}; attributes['pn'] = { isPlural:true, pnform:['array',prplaces], type:'w', pos:'pn', position:['def','none'], level:['def',0], deep:['def',defdeep]}; attributes['ipn'] = { isPlural:true, type:'w', pos:'ipn', third:['def',3], position:['def','none'], ntype:['def','anm'], level:['def',0], deep:['def',defdeep]}; var grammar = {}; var ggroups = ['動詞部の変形','動詞パターンの構成要素','その他の品詞']; var gNames = {'be':'Be動詞','gen':'一般動詞','past':'過去形','have':'完了形','progressive':'進行形','passive':'受動態','modal':'助動詞','inf':'不定詞','ger':'動名詞','ing':'現在分詞','pp':'過去分詞','that':'that節','wh':'疑問詞節','wh_inf':'疑問詞＋不定詞節','pn':'人称代名詞','n':'名詞','a_n':'冠詞','aj':'形容詞','ipn':'指示代名詞','be|gen':'Be動詞か一般動詞'}; var mygrammar = []; grammar['be']= {group:0,grammar:['pn'],gpage:{be:true,gFilter:['be']},func:function(on){ if(on == false){ attributes['vp']['be'] = ['fix',false];}}}grammar['gen']= {group:0,grammar:['pn'],gpage:{be:false,gFilter:['gen']},func:function(on){ if(on == false){ attributes['vp']['be'] = ['fix',true];}}}grammar['past']= {group:0,grammar:['be|gen'],gpage:{past:true},func:function(on){ if(on == false){ attributes['vp']['past'] = ['fix',false];}}}grammar['have']= {group:0,grammar:['be|gen'],gpage:{have:true},func:function(on){ if(on == false){ attributes['vp']['have'] = ['fix',false];}}}grammar['passive']= {group:0,grammar:['be','gen'],gpage:{passive:true},func:function(on){ if(on == false){ attributes['vp']['passive'] = ['fix',false];}}}grammar['progressive']= {group:0,grammar:['be'],gpage:{progressive:true},func:function(on){ if(on == false){ attributes['vp']['progressive'] = ['fix',false];}}}grammar['modal']= {group:0,grammar:['be|gen'],gpage:{modal:true},func:function(on){ if(on == false){ attributes['vp']['modal'] = ['fix',false];}}}grammar['inf']= {group:1,grammar:['be|gen'],gpage:{be:true,gFilter:['inf']},func:function(on){ if(on == false){ Vforms.pop2('inf');}}}grammar['ger']= {group:1,grammar:['be|gen'],gpage:{be:true,gFilter:['ger']},func:function(on){ if(on == false){ Vforms.pop2('ger');}}}grammar['ing']= {group:1,grammar:['be|gen'],gpage:{be:true,gFilter:['ing']},func:function(on){ if(on == false){ Vforms.pop2('ing');}}}grammar['pp']= {group:1,grammar:['gen'],gpage:{be:true,gFilter:['pp']},func:function(on){ if(on == false){ Vforms.pop2('pp');}}}grammar['that']= {group:1,grammar:['be|gen'],gpage:{be:true,gFilter:['that']},func:function(on){ if(on == false){ Vforms.pop2('that');}}}grammar['wh']= {group:1,grammar:['be|gen'],gpage:{be:true,gFilter:['wh']},func:function(on){ if(on == false){ Vforms.pop2('wh');}}}grammar['wh_inf']= {group:1,grammar:['inf'],gpage:{be:true,gFilter:['wh_inf']},func:function(on){ if(on == false){ Vforms.pop2('wh_inf');}}}grammar['pn']= {group:2,gpage:{be:true},func:function(on){ if(on == false){ Stypes.pop2('pn'); Ctypes.pop2('pn');}}}grammar['ipn']= {group:2,gpage:{be:true},func:function(on){ if(on == false){ Stypes.pop2('ipn'); Ctypes.pop2('ipn');}}}grammar['n']= {group:2,gpage:{be:true},func:function(on){ if(on == false){ Stypes.pop2('a_n'); Ctypes.pop2('a_n');}}}grammar['aj']= {group:2,gpage:{be:true},func:function(on){ if(on == false){ Stypes.pop2('aj'); Ctypes.pop2('aj');}}}grammar['a_n']= {group:2,grammar:['n'],gpage:{be:true},func:function(on){ if(on == false){ Stypes.pop2('a_n'); Ctypes.pop2('a_n');}}}function capitalize(txt){ return txt.slice(0,1).toUpperCase()+txt.slice(1);}function joinSpace(txt){ while(txt.match("  ")){ txt = txt.replace("  "," ");}return txt.replace(/^ /,"").replace(/ $/,"");}function r(num,init){ if(num==u){num=2;}if(init==u){init=0;}return Math.floor(Math.random()*num)+init;}function tf(){ if(Math.floor(Math.random()*2) == 0){ return true;}else{ return false;}}function attr(obj,attrs){ obj.attrs = attrs; for(var i in attributes[cName()]){ if(isArray(attributes[cName()][i]) && attributes[cName()][i][0] == 'fix'){ obj[i] = attributes[cName()][i][1];}else if(obj[i] == u){ if(attrs != u && attrs[i] != u){ if(isArray(attributes[cName()][i]) && attributes[cName()][i][0] == 'array' && isArray(attrs[i])){ obj[i] = attrs[i].rand();}else{ obj[i] = clone(attrs[i]);}}else{ if(typeof(attributes[cName()][i]) == "boolean"){ obj[i] = tf();}else if(typeof(attributes[cName()][i]) == "function"){ attributes[cName()][i](obj);}else if(typeof(attributes[cName()][i]) == "string"){ obj[i] = attributes[cName()][i];}else if(isArray(attributes[cName()][i]) && attributes[cName()][i][0] == 'def'){ obj[i] = clone(attributes[cName()][i][1]);}else if(isArray(attributes[cName()][i]) && attributes[cName()][i][0] == 'array'){ obj[i] = attributes[cName()][i][1].rand();}else if(isArray(attributes[cName()][i]) && attributes[cName()][i][0] == 'e'){ obj[i] = new e(attributes[cName()][i][1]);}else{ obj[i] = attributes[cName()][i].rand();}}}}}function showObj(word){ var html = ''; var funcs = ''; var count = 0; for(var i in word){ if(typeof(word[i]) == 'object'){ html += '<br /><span class="toggle">'+i+'</span>:'+showObj(word[i]);}else if(typeof(word[i]) != 'function'){ if(i == 'val'){ html = i+' : <span class="key">'+word[i]+'</span>'+html;}else{ if(i=='type'||i=='stype'||i=='pos'||i=='ctype'||i=='svtype'||i=='eltype'){ html += ' '+i+' : <span class="white">'+word[i]+'</span>';}else{ html += '<br />'+i+' : <span class="white">'+word[i]+'</span>';}}}else if(!(isArray(word) && typeof(i)!='number')){ funcs += ' <span class="toggle grey">'+i+'()</span>:<div class="showobj">'+word[i].toString().replace("<",'&#60;')+'</div>';}count++;}html = '<div class="showobj">'+html+'<br /><span class="grey">'+funcs+'</span></div>'; return html;}function bmppV(obj){ var isO = false; var isPattern = false; if(obj.pattern!=u){ isPattern = true; for(var i=0;i<obj.pattern.val.length;i++){ if(obj.pattern.val[i].eltype!=u &&obj.pattern.val[i].eltype=='O'){ isO = true; break;}}}if(obj.be || (isPattern && isO == false)){ obj.passive = false;}if(obj.modal && obj.past){ if(tf()){ obj.modal = false;}else{ obj.past = false;}}}function inherit(son,parent,attrs,over){ if(typeof(attrs)== 'boolean'){ over = attrs; attrs = undefined;}if(attrs == u){ for(var i in parent){ if(son[i] == u || over){ son[i] = parent[i];}}}else{ for(var i=0;i<attrs.length;i++){ if(parent[attrs[i]]!=u && (son[attrs[i]]==u || over)){ son[attrs[i]] = parent[attrs[i]];}}}}function clone(obj){ if(isArray(obj)){ var temp = []; for(var i=0;i<obj.length;i++){ temp.push(clone(obj[i]));}}else if(typeof(obj)== 'object'){ var temp = {}; for(var i in obj){ if(typeof(obj[i]) == 'object'){ temp[i] = clone(obj[i]);}else{ temp[i] = obj[i];}}}else{ temp = obj;}return temp;}function cName(){ return arguments.callee.caller.caller.name;}function filter(oVps,fVps){ var tempA = oVps; for(var i=0;i<fVps.length;i++){ if(tempA.search(fVps[i])!==false){ tempA.pop2(tempA.search(fVps[i]));}}return tempA;}function uif(val1,val2){ if(val2 == u){ val2 = true;}if(val1 == u || val1 != val2){ return false;}else if(val1 == val2){ return true;}}var multic = 0; var pInjection = []; var wInjection = []; var gInjection = []; var eobj = {type:'vp',Vform:'sent'}; $(document).ready(function(){ if($("#uno").val()!="" && $("#testall").val()!=1){ loadDBPatterns($("#uno").val());}else{ loadDBPatterns();}}); var myPatterns = []; function loadDBPatterns(uid){ if(uid == undefined){ uid = '';}var parameter = $.param({uid:uid}); $.ajax({ url: $('#base').val()+'php/loadDBPatterns.php', type: 'POST', data: parameter, dataType: 'json', success: function(data) { myPatterns = data; myPatterns.merge(pInjection).unique(); loadDBWords(uid);}, error: function(data){ $("#chat").html(''); $("#eloading2").html('<b>'+username+'</b> さんはまだチャットをするのに十分な英語知能を作成していません');}});}function loadDBWords(uid){ if(uid == undefined){ uid = '';}var parameter = $.param({uid:uid}); $.ajax({ url: $('#base').val()+'php/loadDBWord.php', type: 'POST', data: parameter, dataType: 'json', success: function(data) { for(var i in data){ for(var j in data[i]){ for(var k=0;k<data[i][j].length;k++){ if(words[i] == undefined){ words[i] = {};}if(words[i][j] == undefined){ words[i][j] = [];}words[i][j].push(data[i][j][k]);}}}for(var i=0;i<wInjection.length;i++){ if(words[wInjection[i]['pos']] == u){ words[wInjection[i]['pos']] = {};}if(words[wInjection[i]['pos']][wInjection[i]['word']] == u){ words[wInjection[i]['pos']][wInjection[i]['word']] = [];}var wexist = false; for(var j=0;j<words[wInjection[i]['pos']][wInjection[i]['word']].length;j++){ if(words[wInjection[i]['pos']][wInjection[i]['word']][j].id != u || words[wInjection[i]['pos']][wInjection[i]['word']][j].id ==wInjection[i].val.id){ wexist = true; break;}}if(wexist == false){ words[wInjection[i]['pos']][wInjection[i]['word']].push(wInjection[i]['val']);}}loadDBGrammar(uid);}, error: function(data){ $("#chat").html(''); $("#eloading2").html(username+' さんはチャットをするのに十分な英語知能をまだ獲得していません');}});}function loadDBGrammar(uid){ if(uid == undefined){ uid = '';}var parameter = $.param({uid:uid}); $.ajax({ url: $('#base').val()+'php/loadDBGrammar.php', type: 'POST', data: parameter, dataType: 'json', success: function(data) { data.merge(gInjection); data.unique(); mygrammar = []; for(var i in grammar){ if(data.search(i) === false){ mygrammar.push({id:i,value:false});}else{ mygrammar.push({id:i,value:true}); allGrammar.push(i);}}var noVP = []; for(var i=0;i<mygrammar.length;i++){ grammar[mygrammar[i]['id']].func(mygrammar[i].value); if(mygrammar[i].value==false){ noVP.push(mygrammar[i]['id']);}}var newVP = []; for(var i=0;i<vPatterns.length;i++){ if(vPatterns[i]['grammar'].intersect(noVP).length!=0){ delete vPatterns[i];}else{ newVP.push(vPatterns[i]);}}buildVpmap(newVP); initWords();}, error: function(data){ $("#chat").html(''); $("#eloading2").html(username+' さんはチャットをするのに十分な英語知能をまだ獲得していません');}});}function forJipanglish(){ var word = new e(eobj); return word;}function multiGen(){ var word = new e(eobj); var html = word.val; $("#res").html($("#res").html()+'<br />'+html); if(multic < 100){ setTimeout("multiGen()",1);}multic++;}function initWords(){ for(var i=0;i<vPatterns.length;i++){ vpmap[vPatterns[i]["name"]] = i; vPatterns[i].v = []; vPatterns[i].vv = [];}for(var i in words){ wordmap[i] = []; for(var j in words[i]){ wordmap[i].push(j); for(var k=0;k<words[i][j].length;k++){ if(i == 'v'){ wComp(words[i][j][k],j);}else if(i == 'n'){ nComp(words[i][j][k],j);}else if(i == 'aj'){ ajComp(words[i][j][k],j);}else if(i == 'ad'){ ajComp(words[i][j][k],j);}if(i== 'v' || i == 'v_v'){ var vtag = 'v'; if(i=='v_v'){ vtag = 'vv';}if(words[i][j][k].vp!=u){ for(var z=0;z<words[i][j][k].vp.length;z++){ if(vPatterns[vpmap[words[i][j][k].vp[z]]] != u){ vPatterns[vpmap[words[i][j][k].vp[z]]][vtag].push({spell:j,index:k,id:words[i][j][k].id});}}}}if(words[i][j][k].id != undefined){ wordIdMap[words[i][j][k].id.toString()] = {word:j,index:k,pos:i};}}}}var newVP = []; for(var i=0;i<vPatterns.length;i++){ if(myPatterns.search(vPatterns[i]['name'])===false || (vPatterns[i].grammar.search('gen')!==false && (vPatterns[i].v.length==0 && vPatterns[i].vv.length==0))){ delete vPatterns[i];}else{ newVP.push(vPatterns[i]);}}vpmap = {}; allVp = []; vPatterns = newVP; for(var i=0;i<vPatterns.length;i++){ var tempVInd = []; var tempSInd = []; var tempOInd = []; var tempCInd = []; var tempAj = false; var tempO = false; vpmap[vPatterns[i]["name"]] = i; allVp.push(vPatterns[i].name); for(var j=0;j<vPatterns[i].val.length;j++){ if(uif(vPatterns[i].val[j].eltype,'O')){ tempOInd.push(j)tempO = true;}else if(uif(vPatterns[i].val[j].eltype,'S')){ tempSInd.push(j)}else if(uif(vPatterns[i].val[j].eltype,'C')){ tempCInd.push(j); if(vPatterns[i].val[j].Ctype != u && vPatterns[i].val[j].Ctype.search('aj')!==false){ tempAj = true;}}else if(uif(vPatterns[i].val[j].eltype,'V')){ tempVInd.push(j)}else if(uif(vPatterns[i].val[j].type,'vp')){ incVps.push(vPatterns[i].name);}}vPatterns[i].isAj = tempAj; vPatterns[i].vIndexes = tempVInd; vPatterns[i].sIndexes = tempSInd; vPatterns[i].cIndexes = tempCInd; vPatterns[i].oIndexes = tempOInd; vPatterns[i].isO = tempO; if(tempO){ isOs.push(vPatterns[i].name);}}incVps.unique(); for(var i in grammar){ if(gramap[i]== undefined){ gramap[i] = [];}if(grammar[i]['grammar']!=undefined){ for(var j=0;j<grammar[i]['grammar'].length;j++){ if(gramap[grammar[i]['grammar'][j]]== undefined){ gramap[grammar[i]['grammar'][j]] = [];}gramap[grammar[i]['grammar'][j]].push(i);}}}if(timeline == 1){ newComment(true);}else if(timeline == 2){ patternComment();}else if(timeline == 3){ wordComment();}else if(timeline == 4){ grammarComment();}else if(timeline == 5){ homeComment();}}function vpPop(delName){ var delNames = []; if(isArray(delName)){ delNames = delName;}else{ delNames.push(delName);}var newVP = []; for(var i=0;i<vPatterns.length;i++){ if(delNames.search(vPatterns[i]['name'])!==false){ delete vPatterns[i];}else{ newVP.push(vPatterns[i]);}}buildVpmap(newVP)}function buildVpmap(newVP){ vpmap = {}; allVp = []; incVps = []; isOs = []; vPatterns = newVP; for(var i=0;i<vPatterns.length;i++){ vpmap[vPatterns[i]["name"]] = i; allVp.push(vPatterns[i].name); for(var j=0;j<vPatterns[i].val.length;j++){ if(uif(vPatterns[i].val[j].type,'vp')){ incVps.push(vPatterns[i].name);}}if(vPatterns[i].isO){ isOs.push(vPatterns[i].name);}}}function nComp(obj,baseN){ for(var i=0;i<nforms.length;i++){ if(obj[nforms[i]] == u||obj[nforms[i]] == ''){ switch(nforms[i]){ case 'singular':obj['singular'] = baseN;break; case 'plural':nPlural(obj);break;}}}}function ajComp(obj,baseN){ for(var i=0;i<ajforms.length;i++){ if(obj[ajforms[i]] == u||obj[ajforms[i]] == ''){ switch(ajforms[i]){ case 'base':obj['base'] = baseN;break; case 'more':ajMore(obj);break; case 'most':ajMost(obj);break;}}}}function wComp(obj,baseV){ for(var i=0;i<setforms.length;i++){ if(obj[setforms[i]] == u||obj[setforms[i]] == ''){ switch(setforms[i]){ case 'base':obj['base'] = baseV;break; case 'three':vThree(obj);break; case 'past':vPast(obj);break; case 'perfect':obj['perfect']=obj['past'];break; case 'ing':vING(obj);break;}}}}function nPlural(obj){ var sp3 = obj['singular']; if(sp3.length > 1 && sp3.match(/y$/) && !sp3[sp3.length-2].match(/[aiueo]/)){ sp3 = sp3.replace(/y$/,'i')+'es';}else if(sp3.length > 1 && (sp3.match(/(s$|x$|ch$|sh$)/) || (sp3.match(/o$/) && !sp3[sp3.length-2].match(/[aiueo]/)))){ sp3 += 'es';}else if((obj.exception == u || !obj.exception) && sp3.length > 1 && (sp3.match(/f$/) || sp3.match(/fe$/))){ sp3 = sp3.replace(/(f$|fe$)/,'ves');}else{ sp3 += 's';}obj['plural'] = sp3;}function vThree(obj){ var sp3 = obj['base']; if(sp3.length > 1 && sp3.match(/y$/) && !sp3[sp3.length-2].match(/[aiueo]/)){ sp3 = sp3.replace(/y$/,'i')+'es';}else if(sp3.length > 1 && (sp3.match(/(s$|x$|ch$|sh$)/) || (sp3.match(/o$/) && !sp3[sp3.length-2].match(/[aiueo]/)))){ sp3 += 'es';}else{ sp3 += 's';}obj['three'] = sp3;}function vING(obj){ var sp3 = obj['base']; if(sp3.match(/c$/)){ sp3 += 'king';}else if(!(obj.exception != u && obj.exception == true) && sp3.length > 1 && (!sp3.match(/[aiueo]$/) && sp3[sp3.length-2].match(/[aiueo]/) && !(sp3.length > 2 && sp3[sp3.length-3].match(/[aiueo]/)))){ sp3 += sp3[sp3.length-1]+'ing';}else if(sp3.match(/ie$/)){ sp3 = sp3.slice(0,-2)+'ying';}else if(sp3.length > 1 && (sp3.match(/e$/) && !sp3[sp3.length-2].match(/[aiueo]/))){ sp3 = sp3.slice(0,-1)+'ing';}else{ sp3 += 'ing';}obj['ing'] = sp3;}function vPast(obj){ var sp3 = obj['base']; if(sp3.match(/c$/)){ sp3 += 'ked';}else if(!(obj.exception != u && obj.exception == true) && sp3.length > 1 && (!sp3.match(/[aiueo]$/) && sp3[sp3.length-2].match(/[aiueo]/) && !(sp3.length > 2 && sp3[sp3.length - 3].match(/[aiueo]/)))){ sp3 += sp3[sp3.length-1]+'ed';}else if(sp3.length > 1 && (sp3.match(/y$/) && !sp3[sp3.length-2].match(/[aiueo]/))){ sp3 = sp3.slice(0,-1)+'ied';}else if(sp3.match(/e$/)){ sp3 += 'd';}else{ sp3 += 'ed';}obj['past'] = sp3;}function ajMore(obj){ var sp3 = obj['base']; if(obj.shorter){ if(sp3.length > 1 && (!sp3.match(/[aiueo]$/) && sp3[sp3.length-2].match(/[aiueo]/) && !(sp3.length > 2 && sp3[sp3.length-3].match(/[aiueo]/)))){ sp3 += sp3[sp3.length-1]+'er';}else if(sp3.length > 1 && (sp3.match(/y$/) && !sp3[sp3.length-2].match(/[aiueo]/))){ sp3 = sp3.slice(0,-1)+'ier';}else if(sp3.match(/e$/)){ sp3 += 'r';}else{ sp3 += 'er';}}else{ sp3 = 'more '+sp3;}obj['more'] = sp3;}function ajMost(obj){ var sp3 = obj['base']; if(obj.shorter){ if(sp3.length > 1 && (!sp3.match(/[aiueo]$/) && sp3[sp3.length-2].match(/[aiueo]/) && !(sp3.length > 2 && sp3[sp3.length-3].match(/[aiueo]/)))){ sp3 += sp3[sp3.length-1]+'est';}else if(sp3.length > 1 && (sp3.match(/y$/) && !sp3[sp3.length-2].match(/[aiueo]/))){ sp3 = sp3.slice(0,-1)+'iest';}else if(sp3.match(/e$/)){ sp3 += 'st';}else{ sp3 += 'est';}}else{ sp3 = 'most '+sp3;}obj['most'] = sp3;}function e(attrs){ attr(this,attrs); eval(this.type + '(attrs,this)'); this.val = joinSpace(this.val); if(uif(this.Vform,'sent')){ this.val += '.';}}function sv(attrs,obj){ attr(obj,attrs); var sub = neg = val = pre = modal = ''; var have = prog = passive = {val:''}; obj.s = new e({type:'c',ctype:'a_n'}); obj.vPattern = new e({type:'vp',s:obj.s}); obj.svElems = []; if(obj.vPattern.vElems[obj.vPattern.vPlace].be){ obj.passive = false;}if(obj.have){ have = new e({type:'w',pos:'v',base:'have',be:false,form:'base'}); obj.svElems.push(have); if(obj.passive){ passive = new e({type:'w',pos:'v',be:true,form:'perfect'}); obj.svElems.push(passive); if(obj.progressive){ prog = new e({type:'w',pos:'v',be:true,form:'ing'}); obj.svElems.push(prog); obj.vPattern.to('perfect');}else{ obj.vPattern.to('perfect');}}else{ if(obj.progressive){ prog = new e({type:'w',pos:'v',be:true,form:'perfect'}); obj.svElems.push(prog); obj.vPattern.to('ing');}else{ obj.vPattern.to('perfect');}}}else{ if(obj.passive){ passive = new e({type:'w',pos:'v',be:true,form:'base'}); obj.svElems.push(passive); if(obj.progressive){ prog = new e({type:'w',pos:'v',be:true,form:'ing'}); obj.svElems.push(prog); obj.vPattern.to('perfect');}else{ obj.vPattern.to('perfect');}}else{ if(obj.progressive){ prog = new e({type:'w',pos:'v',be:true,form:'base'}); obj.svElems.push(prog); obj.vPattern.to('ing');}else{ obj.vPattern.to('base');}}}obj.svElems.push(obj.vPattern); switch(obj.svtype){ case 'to':obj.svElems[0].to('base'); pre = 'to'; if(obj.s){sub = 'for '+obj.s.val;}if(obj.negative){neg = 'not';}break; case 'ger':obj.svElems[0].to('ing'); if(obj.s){sub = obj.s.val;}if(obj.negative){neg = 'not';}break; case 'sent':if(obj.modal && obj.past){ if(tf()){ obj.modal = false;}else{ obj.past = false;}}if(obj.modal){ obj.svElems[0].to('base'); modal = 'will';}else if(obj.past){ obj.svElems[0].to('past');}else{ obj.svElems[0].to('three');}sub = obj.s.val; if(obj.negative){neg = 'not';}break;}for(var i=0;i<obj.svElems.length;i++){ val += ' '+obj.svElems[i].val;}obj.val = sub+' '+neg+' '+' '+pre+' '+modal+' '+val;}function w(attrs,obj){ attr(obj,attrs); eval(obj.pos + '(attrs,obj)');}function c(attrs,obj){ attr(obj,attrs); eval(obj.ctype + '(attrs,obj)');}function el(attrs,obj){ attr(obj,attrs); eval(obj.eltype + '(attrs,obj)');}function vp(attrs,obj){ attr(obj,attrs); inherit(obj,obj.pattern,['oIndexes','sIndexes','cIndexes','vIndexes'],true); obj.val = ''; obj.vElems = []; for(var i=0;i<obj.pattern.val.length;i++){ if(uif(obj.pattern.val[i].eltype,'V')){ obj.vIndex = i; if(obj.pattern.val[i].be != u){ obj.be = obj.pattern.val[i].be;}inherit(obj,obj.pattern.val[i],['progressive','modal','have'],true); bmppV(obj); inherit(obj.pattern.val[i],attrs,['base','Vtype','baseId']); inherit(obj.pattern.val[i],obj,['be','have','progressive','passive','past','modal','vform','vpname']); inherit(obj.pattern.val[i],obj.s,['isPlural','third']);}else if(uif(obj.pattern.val[i].eltype,'C')){ obj.cIndex = i; inherit(obj.pattern.val[i],attrs,['Ctype','the']); if(obj.accord && obj.be){ inherit(obj.pattern.val[i],obj.s,['ntype','isPlural','third']);}if(uif(obj.oInherit) && obj.nPosition == i){ obj.pattern.val[i].Ctype = 'a_n'; inherit(obj.pattern.val[i],obj,['nBaseId']);}else if(obj.ajBaseId!=u){ obj.pattern.val[i].Ctype = 'aj'; inherit(obj.pattern.val[i],obj,['ajBaseId']);}}else if(uif(obj.pattern.val[i].eltype,'O')){ }else if(uif(obj.pattern.val[i].pos,'pre') && (obj.vpname == 'SVIOPreDO'||obj.vpname == 'SVIOPreIng')){ if(obj.vElems[obj.vIndex].v.pres != u){ obj.pattern.val[i].base = obj.vElems[obj.vIndex].v.pres.rand();}}else if(obj.pattern.val[i].type == 'vp'){ if(uif(obj.pattern.val[i].vpInherit,true)){ inherit(obj.pattern.val[i],attrs,['vpname']);}if(uif(obj.sInherit,true)){ obj.pattern.val[i].s = obj.s; obj.pattern.val[i].accord = true;}}else if(uif(obj.pattern.val[i].ctype,'comp')){ if(uif(obj.pattern.val[i].vpInherit,true)){ obj.pattern.val[i].vpname = obj.vpname;}if(uif(obj.noComp,true)){ obj.pattern.val[i].cmpForm = 'base';}}if(uif(obj.pattern.val[i].eltype,'O')){ inherit(obj.pattern.val[i],attrs,['Otype']); if(uif(obj.oInherit) && obj.nPosition == i){ obj.pattern.val[i].Otype = 'a_n'; inherit(obj.pattern.val[i],obj,['nBaseId']);}}if(uif(obj.pattern.val[i].eltype,'S')){ var temp = obj.s;}else{ inherit(obj.pattern.val[i],obj,['deep','level']); var temp = new e(obj.pattern.val[i]);}obj.vElems.push(temp); obj.val += ' '+temp.val;}if(obj.oIndexes.length != 0){ obj.oIndex = obj.oIndexes.rand();}obj.to = function(Vform){ this.val = ''; if(Vform == 'pp' && this.be){ Vform = 'ing'; this.Vform = 'ing';}if((Vform == 'wh' || Vform =='wh_inf' || Vform=='wh_question')&& this.wh == u){ var tempE = {type:'w',pos:'wh'}; inherit(tempE,obj,['deep','level']); if(this.oIndex == u){ tempE.noO = true; this.wh = new e(tempE);}else{ this.wh = new e(tempE);}}var val = ''; if(Vform == 'sent' || Vform == 'that' || Vform == 'wh' || Vform == 'question' || Vform == 'wh_question'){ for(var i=0;i<this.vElems.length;i++){ if(uif(this.vElems[i].eltype,'V')){ this.vElems[i].modal = this.modal; this.vElems[i].passive = this.passive; this.vElems[i].progressive = this.progressive; this.vElems[i].have = this.have; if(this.modal){ this.vElems[i].to('base');}else if(this.past){ this.vElems[i].to('past');}else{ this.vElems[i].to('present');}if( uif(this.vElems[i].middle,true)&& this.oIndex != u&& this.passive == false&& (this.vElems[i].Otype == 'ipn' || this.vElems[i].Otype == 'pn') ){ this.vElems[i].putPn(this.vElems[this.oIndex].val);}}if( !(obj.noComp == true && uif(this.vElems[i].ctype,'comp'))&& !((Vform == 'wh'||Vform=='wh_inf' || Vform=='wh_question') && ['how','when','where'].search(this.wh.val)===false &&this.oIndex==i)&& !(this.passive && this.oIndex == i)&& !( uif(this.vElems[this.vIndex].middle,true)&& uif(this.oIndex,i)&& (this.vElems[i].Otype == 'ipn' || this.vElems[i].Otype == 'pn')) ){ if((Vform == 'question'||Vform=='wh_question') && uif(this.vElems[i].eltype,'V')){ if(this.negative){ val += ' '+this.vElems[i].qNVal2+' ';}else{ val += ' '+this.vElems[i].qVal2+' ';}}else if(this.negative && uif(this.vElems[i].eltype,'V')){ if(this.shortN){ val += ' '+this.vElems[i].sNVal+' ';}else{ val += ' '+this.vElems[i].nVal+' ';}}else{ val += ' '+this.vElems[i].val;}}}if(Vform == 'wh_question'){ this.val += ' '+this.wh.val+' ';}if(Vform == 'question'||Vform == 'wh_question'){ if(this.negative){ this.val += ' '+this.vElems[this.vIndex].qNVal1+' ';}else{ this.val += ' '+this.vElems[this.vIndex].qVal1+' ';}}if(this.sposition){ this.val += ' '+val;}else{ this.val += ' '+this.s.val+' '+val;}if(this.passive && this.byon){ this.val += ' by '+this.by.val;}if(Vform == 'that' && this.thatoff ==false){ this.val = "that "+this.val;}else if(Vform == 'wh'){ this.val = this.wh.val+' '+this.val; if((this.wh.val == 'if' || this.wh.val == 'wheather') && this.ornotoff == false){ this.val += ' or not';}}if(Vform == 'question'||Vform == 'wh_question'){ this.val += '?';}}else if(Vform == 'inf' || Vform == 'base' || Vform == 'wh_inf' || Vform == 'order'){ for(var i=0;i<this.vElems.length;i++){ if(this.vElems[i].type =='el' && this.vElems[i].eltype == 'V'){ this.vElems[i].modal = false; this.vElems[i].passive = this.passive; this.vElems[i].progressive = this.progressive; this.vElems[i].have = this.have; if(Vform == 'order'){ this.vElems[i].have = false; this.vElems[i].past = false;}this.vElems[i].to('base'); this.vElems[i].toPositive(); if( uif(this.vElems[i].middle,true)&& this.oIndex != u&& this.passive == false&& (this.vElems[this.oIndex].Otype == 'ipn' || this.vElems[this.oIndex].Otype == 'pn') ){ this.vElems[i].putPn(this.vElems[this.oIndex].val);}}if( !(obj.noComp == true && uif(this.vElems[i].ctype,'comp'))&& !((Vform == 'wh'|| Vform=='wh_inf') && ['how','when','where'].search(this.wh.val)===false &&this.oIndex==i)&& !(this.passive && this.oIndex == i)&& !( uif(this.vElems[this.vIndex].middle,true)&& uif(this.oIndex,i)&& (this.vElems[i].Otype == 'ipn' || this.vElems[i].Otype == 'pn')) ){ val += ' '+this.vElems[i].val;}}if(Vform == 'inf' || Vform=='wh_inf'){ this.val = 'to '+ val;}else{ this.val = val;}if(this.negative){ if(Vform == 'order'){ this.val = "Don't "+this.val;}else{ this.val = 'not '+this.val;}}if(Vform!='wh_inf' && Vform!='order' && this.son){ if(this.s.Stype =='pn'){ this.val = 'for '+this.s.me+' '+this.val;}else{ this.val = 'for '+this.s.val+' '+this.val;}}if(Vform=='wh_inf'){ this.val = this.wh.val+' '+this.val;}}else if(Vform == 'ger' || Vform == 'ing' || Vform == 'pp'){ for(var i=0;i<this.vElems.length;i++){ if(this.vElems[i].type =='el' && this.vElems[i].eltype == 'V'){ this.vElems[i].passive = this.passive; this.vElems[i].progressive = this.progressive; this.vElems[i].have = this.have; this.vElems[i].modal = false; if(Vform == 'ing' || Vform == 'pp'){ this.vElems[i].passive = false; this.vElems[i].progressive = false; if(Vform == 'pp'){ this.vElems[i].have = false;}}if(Vform == 'pp'){ this.vElems[i].to('perfect');}else{ this.vElems[i].to('ing');}this.vElems[i].toPositive(); if( uif(this.vElems[i].middle,true)&& this.oIndex != u&& this.passive == false&& (this.vElems[this.oIndex].Otype == 'ipn' || this.vElems[this.oIndex].Otype == 'pn') ){ this.vElems[i].putPn(this.vElems[this.oIndex].val);}}if(!(obj.noComp == true && this.vElems[i].ctype!=u && this.vElems[i].ctype == 'comp')&& !(Vform == 'pp' && this.vElems[i].eltype == 'O')&& !(this.passive && this.vElems[i].eltype == 'O')&& !( uif(this.vElems[this.vIndex].middle,true)&& uif(this.oIndex,i)&& (this.vElems[this.oIndex].Otype == 'ipn' ||this.vElems[this.oIndex].Otype == 'pn')) ){ val += ' '+this.vElems[i].val;}}if(this.son){ if(this.s.Stype =='pn'){ this.val = 'for '+this.s.me+' '+val;}else{ this.val = 'for '+this.s.val+' '+val;}}else{ this.val = val;}if(this.negative){ this.val = 'not '+this.val;}if(Vform == 'pp' && this.byon){ this.val += ' by '+this.by.val;}}}obj.toNegative = function(){ this.negative = true; this.to(this.Vform);}obj.toPositive = function(){ this.negative = false; this.to(this.Vform);}obj.to(obj.Vform);}function S(attrs,obj){ attr(obj,attrs); if(obj.Stype != u && isArray(obj.Stype)){ obj.Stype = obj.Stype.rand();}if(obj.Stype == 'a_n'){ var tempS = {type:'c',ctype:'a_n'}; inherit(tempS,attrs,['Stype','the','isPlural','third','nBaseId']); inherit(tempS,obj,['deep','level']); var tempObj = new e(tempS);}else if(obj.Stype == 'pn'){ var tempS = {type:'w',pos:'pn',pnform:'i'}; inherit(tempS,obj,['deep','level']); var tempObj = new e(tempS);}else if(obj.Stype == 'ipn'){ var tempS = {type:'w',pos:'ipn'}; inherit(tempS,obj,['deep','level']); var tempObj = new e(tempS);}inherit(obj,tempObj);}function O(attrs,obj){ attr(obj,attrs); if(obj.Otype == 'a_n'){ var tempS = {type:'c',ctype:'a_n'}; inherit(tempS,obj,['deep','level']); inherit(tempS,attrs,['Otype','the','isPlural','third','nBaseId']); var tempObj = new e(tempS);}else if(obj.Otype == 'pn'){ var tempS = {type:'w',pos:'pn',pnform:'me'}; inherit(tempS,obj,['deep','level']); var tempObj = new e(tempS);}else if(obj.Otype == 'ipn'){ var tempS = {type:'w',pos:'ipn'}; inherit(tempS,obj,['deep','level']); var tempObj = new e(tempS);}inherit(obj,tempObj);}function C(attrs,obj){ attr(obj,attrs); if(obj.Ctype == 'a_n'){ var tempS = {type:'c',ctype:'a_n'}; inherit(tempS,obj,['deep','level']); inherit(tempS,attrs,['Ctype','the','isPlural','third','nBaseId']); var tempObj = new e(tempS);}else if(obj.Ctype == 'pn'){ var tempS = {type:'w',pos:'pn',pnform:'me'}; inherit(tempS,obj,['deep','level']); var tempObj = new e(tempS);}else if(obj.Ctype == 'ipn'){ var tempS = {type:'w',pos:'ipn'}; inherit(tempS,obj,['deep','level']); var tempObj = new e(tempS);}else if(obj.Ctype == 'aj'){ var tempS = {type:'w',pos:'aj',ajform:'base'}; inherit(tempS,obj,['deep','level','ajBaseId']); var tempObj = new e(tempS);}inherit(obj,tempObj);}function V(attrs,obj){ attr(obj,attrs); if(obj.Vtype == 'v' || obj.be){ var tempObj = {type:'w',pos:'v'};}else if(obj.Vtype == 'v_v'){ var tempObj = {type:'c',ctype:'v_v'};}inherit(tempObj,obj,['vform','be','isPlural','third','deep','level']); inherit(tempObj,attrs,['base','vpname','baseId']); var vcheck='v'; if(tempObj.ctype == 'v_v'){ vcheck='vv';}if(tempObj.be == false && tempObj.vpname!=u && vpmap[tempObj.vpname]!=u && vPatterns[vpmap[tempObj.vpname]][vcheck].length == 0){ }obj.v = new e(tempObj); inherit(obj,obj.v,['middle']); bmppV(obj); obj.vElems = []; var sub = ''; var neg = ''; var val = ''; var pre = ''; var modal = ''; var have = {val:''}; var prog = {val:''}; var passive = {val:''}; if(obj.have){ var tempE = {type:'w',pos:'have',vform:'base',vltype:'have',third:obj.third,isPlural:obj.isPlural}; inherit(tempE,obj,['deep','level']); have = new e(tempE); obj.vElems.push(have); if(obj.passive){ var tempE = {type:'w',pos:'v',be:true,vform:'perfect',vltype:'passive',third:obj.third,isPlural:obj.isPlural}; inherit(tempE,obj,['deep','level']); passive = new e(tempE); obj.vElems.push(passive); if(obj.progressive){ var tempE = {type:'w',pos:'be',vform:'ing',vltype:'progressive',third:obj.third,isPlural:obj.isPlural}; inherit(tempE,obj,['deep','level']); prog = new e(tempE); obj.vElems.push(prog); obj.v.to('perfect');}else{ obj.v.to('perfect');}}else{ if(obj.progressive){ var tempE = {type:'w',pos:'be',vform:'perfect',vltype:'progressive',third:obj.third,isPlural:obj.isPlural}; inherit(tempE,obj,['deep','level']); prog = new e(tempE); obj.vElems.push(prog); obj.v.to('ing');}else{ obj.v.to('perfect');}}}else{ if(obj.passive){ var tempE = {type:'w',pos:'be',vform:'base',vltype:'passive',third:obj.third,isPlural:obj.isPlural}; inherit(tempE,obj,['deep','level']); passive = new e(tempE); obj.vElems.push(passive); if(obj.progressive){ var tempE = {type:'w',pos:'be',vform:'ing',vltype:'progressive',third:obj.third,isPlural:obj.isPlural}; inherit(tempE,obj,['deep','level']); prog = new e(tempE); obj.vElems.push(prog); obj.v.to('perfect');}else{ obj.v.to('perfect');}}else{ if(obj.progressive){ var tempE = {type:'w',pos:'be',vform:'base',vltype:'progressive',third:obj.third,isPlural:obj.isPlural}; inherit(tempE,obj,['deep','level']); prog = new e(tempE); obj.vElems.push(prog); obj.v.to('ing');}else{ obj.v.to('base');}}}obj.vElems.push(obj.v); obj.vIndex = obj.vElems.length-1; if(obj.modal){ obj.vElems[0].to('base'); var tempE = {type:'w',pos:'m'}; inherit(tempE,obj,['deep','level']); var m = new e(tempE); obj.vElems.push2(m,0); obj.vIndex++;}else if(obj.past){ obj.vElems[0].to('past');}obj.to = function(form,non){ var val = ''; this.sNVal = ''; this.nVal = ''; this.pVal = ''; this.qVal1 = ''; this.qNVal1 = ''; this.qVal2 = ''; this.qNVal2 = ''; this.vform = form; var first = false; var nega = true; for(var i=0;i<this.vElems.length;i++){ if((form =='base' && this.modal ==true) || uif(this.vElems[i].pos,'m') == false){ if( !( (this.vElems[i].vltype == 'passive' && !this.passive) ||(this.vElems[i].vltype == 'progressive' && !this.progressive) ||(this.vElems[i].vltype == 'have' && !this.have)) ){ if(!non && !first && uif(this.vElems[i].pos,'m') == false){ this.vElems[i].to(form); first = true;}if(nega == true){ nega = false; this.pVal += ' '+this.vElems[i].val; if(this.past){ this.sNVal += ' '+this.vElems[i].pastNS; this.nVal += ' '+this.vElems[i].pastN; this.qNVal1 += ' '+this.vElems[i].pastNQ1; this.qVal1 += ' '+this.vElems[i].pastQ1; this.qNVal2 += ' '+this.vElems[i].pastNQ2; this.qVal2 += ' '+this.vElems[i].pastQ2;}else{ this.sNVal += ' '+this.vElems[i].presentNS; this.nVal += ' '+this.vElems[i].presentN; this.qNVal1 += ' '+this.vElems[i].presentNQ1; this.qVal1 += ' '+this.vElems[i].presentQ1; this.qNVal2 += ' '+this.vElems[i].presentNQ2; this.qVal2 += ' '+this.vElems[i].presentQ2;}}else{ this.pVal += ' '+this.vElems[i].val; this.sNVal += ' '+this.vElems[i].val; this.nVal += ' '+this.vElems[i].val; this.qNVal2 += ' '+this.vElems[i].val; this.qVal2 += ' '+this.vElems[i].val;}}}}if(this.negative){ if(this.shortN){ this.val = this.sNVal;}else{ this.val = this.nVal;}}else{ this.val = this.pVal;}}obj.putPn = function(pn){ this.vElems[this.vIndex].putPn(pn); this.to(this.vform,true);}obj.toNegative = function(){ this.negative = true; this.to(this.vform);}obj.toPositive = function(){ this.negative = false; this.to(this.vform);}obj.to(obj.vform);}function A(attrs,obj){ attr(obj,attrs); obj.val = 'in the world';}function a_n(attrs,obj){ attr(obj,attrs); var tempN = {type:'w',pos:'n'}; inherit(tempN,obj,['the','Stype','isPlural','third','deep','level','nBaseId']); obj.n = new e(tempN); inherit(obj,obj.n,['ntype','isPlural','tp']); var tempA = {type:'w',pos:'a',n:obj.n}; inherit(tempA,obj,['the','deep','level']); obj.a = new e(tempA); obj.val = obj.a.val+' '+obj.n.val; obj.toPn = function(){ this.val = this.n.pn.i;}obj.toAN = function(){ this.val = this.a.val+' '+this.n.val;}obj.i = obj.n.i; obj.third = 3;}function v_v(attrs,obj){ if(attrs.base != u || words['v_v'][attrs.base] != u){ var tempW = clone(words['v_v'][attrs.base].rand());}else if(obj.vpname != u && vpmap[obj.vpname]!=u){ var vpv = vPatterns[vpmap[obj.vpname]].vv.rand(); var tempW = clone(words['v_v'][vpv.spell][vpv.index]);}else{ var tempW = clone(words['v_v'][wordmap['v_v'].rand()].rand());}if(tempW.middle != u){ obj.middle = tempW.middle;}attr(obj,attrs); obj.vvElems = []; obj.val = ''; for(var i=0;i<tempW.val.length;i++){ var temp = tempW.val[i]; inherit(temp,obj,['deep','level']); if(i==0){ inherit(temp,obj,['base','vform','passive','progressive','third','isPlural','vltype','past','modal']); obj.v = new e(temp); inherit(obj,obj.v,['vform','third','isPlural','vltype']); obj.vvElems.push(obj.v);}else{ var tempO = new e(temp); obj.vvElems.push(tempO);}obj.val += ' '+obj.vvElems[i].val;}obj.changePpl=function(ppl,plural){ this.vvElems[0].changePpl(ppl,plural); this.isPlural = plural; this.third = ppl; this.to(this.vform);}obj.to = function(vform){ this.val = ''; this.pastN = ''; this.pastNS = ''; this.presentN = ''; this.presentNS = ''; this.pastQ1 = ''; this.pastQ2 = ''; this.presentQ1 = ''; this.presentQ2 = ''; this.pastNQ1 = ''; this.pastNQ2 = ''; this.presentNQ1 = ''; this.presentNQ2 = ''; for(var i=0;i<this.vvElems.length;i++){ if(i==0){ this.vvElems[i].to(vform); this.pastN += ' '+this.vvElems[i].pastN; this.pastNS += ' '+this.vvElems[i].pastNS; this.presentN += ' '+this.vvElems[i].presentN; this.presentNS += ' '+this.vvElems[i].presentNS; this.pastQ1 += ' '+this.vvElems[i].pastQ1; this.pastQ2 += ' '+this.vvElems[i].pastQ2; this.presentQ1 += ' '+this.vvElems[i].presentQ1; this.presentQ2 += ' '+this.vvElems[i].presentQ2; this.pastNQ1 += ' '+this.vvElems[i].pastNQ1; this.pastNQ2 += ' '+this.vvElems[i].pastNQ2; this.presentNQ1 += ' '+this.vvElems[i].presentNQ1; this.presentNQ2 += ' '+this.vvElems[i].presentNQ2;}else{ this.pastN += ' '+this.vvElems[i].val; this.pastNS += ' '+this.vvElems[i].val; this.presentN += ' '+this.vvElems[i].val; this.presentNS += ' '+this.vvElems[i].val; this.pastQ2 += ' '+this.vvElems[i].val; this.presentQ2 += ' '+this.vvElems[i].val; this.pastNQ2 += ' '+this.vvElems[i].val; this.presentNQ2 += ' '+this.vvElems[i].val;}this.val += ' '+this.vvElems[i].val;}this.vform = vform;}obj.putPn = function(pn){ this.val = ''; for(var i=0;i<this.vvElems.length;i++){ this.val += ' '+this.vvElems[i].val; if(i==0){ this.val += ' '+pn;}}}obj.changePpl(obj.third,obj.isPlural);}function comp(attrs,obj){ attr(obj,attrs); var tempAj = {type:'w',pos:obj.cmpType}; inherit(tempAj,obj,['deep','level']); obj.aj = new e(tempAj); var tempVp = {type:'vp',Vform:'sent',noComp:true}; inherit(tempVp,obj,['vpname','deep','level']); if(obj.cmpForm == 'asas' || obj.compForm == 'more'){ obj.suffix = new e(tempVp);}obj.val = obj.aj.val; obj.to = function(form){ if((form == 'asas' || form == 'more') && this.suffix == u){ var tempVp = {type:'vp',Vform:'sent',noComp:true}; inherit(tempVp,this,['deep','level']); inherit(tempVp,this,['vpname']); this.suffix = new e(tempVp);}var adform = form; if(adform == 'asas'){ adform = 'base';}this.aj.to(adform); this.val = this.aj.val; this.cmpForm = form; if(this.cmpForm == 'most'){ this.val = 'the '+this.val+' in the world';}else if(this.cmpForm == 'asas'){ this.val = 'as '+this.val+' as '+this.suffix.val;}else if(this.cmpForm == 'more'){ this.val = this.val+' than '+this.suffix.val;}}obj.to(obj.cmpForm);}function have(attrs,obj){ attr(obj,attrs); obj.be = false; obj.base = 'have'; obj.baseN = 'have not'; obj.baseNS = "haven't"; obj.three = 'has'; obj.threeN = 'has not'; obj.threeNS = "hasn't"; obj.presentNQ2 = ''; obj.presentQ2 = ''; obj.pastNQ2 = ''; obj.pastQ2 = ''; obj.past = obj.pastthree = 'had'; obj.pastN = obj.pastthreeN = 'had not'; obj.pastNS = obj.pastthreeNS = "hadn't"; obj.pastNQ1 = "hadn't"; obj.pastQ1 = 'had'; obj.perfect = 'had'; obj.ing = 'having'; obj.changePpl=function(ppl,plural){ if(ppl == u){ ppl = nPpl.rand();}if(plural == u){ plural = tf();}if(ppl == 3 && !plural){ this.present = this.three; this.presentN = this.threeN; this.presentNS = this.threeNS; this.presentNQ1 = this.presentNS; this.presentQ1 = this.present;}else{ this.present = this.base; this.presentN = this.baseN; this.presentNS = this.baseNS; this.presentNQ1 = this.baseNS; this.presentQ1 = this.base;}this.isPlural = plural; this.ppl = ppl; this.val = this[this.vform];}obj.to = function(vform){ this.val = this[vform];}obj.changePpl(obj.third,obj.isPlural); obj.to(obj.vform);}function ad(attrs,obj){ attr(obj,attrs); if(attrs.base != u && words['ad'][attrs.base] != u){ var tempW = words['ad'][attrs.base].rand();}else{ var tempW = words['ad'][wordmap['ad'].rand()].rand();}inherit(obj,tempW); obj.to = function(form){ this.val = this[form]; this.adform = form;}obj.to(obj.adform);}function aj(attrs,obj){ attr(obj,attrs); if(attrs.ajBaseId != u && words['aj'][wordIdMap[attrs.ajBaseId].word][wordIdMap[attrs.ajBaseId].index] != u){ var tempW = clone(words['aj'][wordIdMap[attrs.ajBaseId].word][wordIdMap[attrs.ajBaseId].index]);}else if(attrs.base != u && words['aj'][attrs.base] != u){ var tempW = words['aj'][attrs.base].rand();}else{ var tempW = words['aj'][wordmap['aj'].rand()].rand();}inherit(obj,tempW); obj.to = function(form){ this.val = this[form]; this.ajform = form;}obj.to(obj.ajform);}function v(attrs,obj){ attr(obj,attrs); if(attrs.base!=u && attrs.base!='be'){ obj.be = false;}inherit(obj,attrs,['vpname']); var temp = {type:'w'}; inherit(temp,obj); inherit(temp,attrs); if(obj.be){ temp.pos = 'be';}else{ temp.pos = 'gen';}inherit(temp,obj,['deep','level']); var temp2 = new e(temp); inherit(obj,temp2,false);}function pn(attrs,obj){ attr(obj,attrs); var s = ["I","you","he","she","it","we","you","they"]; var s2 = ["my","your","his","her","its","our","your","their"]; var s3 = ["me","you","him","her","it","us","you","them"]; var s4 = ["mine","yours","his","hers","its","ours","yours","theirs"]; var s5 = ["myself","yourself","himself","herself","itself","ourselves","yourselves","theirselves"]; var one = ["I","he","she","it"]; var two = ["we","they"]; var pthree = ["he","she","it"]; var pthird = ["he","she","it","they"]; var pops = []; if(obj.ntype != u){ if(obj.ntype == "ppl"){ pops.push(4);}else if(obj.ntype == "anm"){ pops.push2([0,1,2,3,5,6],[0,1,2,3,4,5]);}}if(obj.isPlural != u){ if(obj.isPlural){ pops.push2([0,1,2,3,4],[0,1,2,3,4]);}else{ pops.push2([5,6,7],[0,1,2]);}}if(attrs.third == 3){ pops.push2([0,1,5,6],[0,1,2,3]);}else if(attrs.third == 2){ pops.push2([0,2,3,4,5,7],[0,1,2,3,4,5]);}else if(attrs.third == 1){ pops.push2([1,2,3,4,6,7],[0,1,2,3,4,5]);}pops.unique(); s.pop2(pops); s2.pop2(pops); s3.pop2(pops); s4.pop2(pops); s5.pop2(pops); var index = r(s.length); obj.i = s[index]; obj.my = s2[index]; obj.me = s3[index]; obj.mine = s4[index]; obj.myself = s5[index]; if(obj.ntype != u){ if(obj.i == "they"){ obj.ntype = ntypes.rand();}else if(obj.i == "it"){ obj.ntype = "anm";}else{ obj.ntype = "ppl";}}if(obj.plural != u){ if(obj.i == "you"){ if(index == 1){ obj.plural = false;}else{ obj.plural = true;}}else if(two.search(obj.i) !== false){ obj.plural = true;}else{ obj.plural = false;}}if(pthird.search(obj.i) !==false ){ obj.third = 3;}else if(obj.i == 'you'){ obj.third = 2;}else{ obj.third = 1;}if(pthree.search(obj.i) !==false){ obj.tp = true;}else{ obj.tp = false;}obj.val = obj[obj.pnform];}function ipn(attrs,obj){ attr(obj,attrs); var s = ["this","that"]; var s1 = ["these","those"]; if(obj.isPlural){ obj.val = s1.rand();}else{ obj.val = s.rand();}}function a(attrs,obj){ attr(obj,attrs); if(obj.the){ obj.val = 'the';}else if(obj.n.isPlural){ obj.val = '';}else{ if(obj.n.val.match(/^[aiueoAIUEO]/)){ obj.val = 'an';}else{ obj.val = 'a';}}}function pre(attrs,obj){ attr(obj,attrs); obj.val = obj.base;}function cj(attrs,obj){ attr(obj,attrs); obj.val = obj.base;}function ij(attrs,obj){ attr(obj,attrs); obj.val = obj.base;}function wh(attrs,obj){ attr(obj,attrs); if(obj.val == u){ if(obj.noO){ obj.val = ['how','when','where'].rand();}else{ obj.val = whs.rand();}}obj.ever = obj.val+'ever';}function m(attrs,obj){ attr(obj,attrs); obj.negative = {}; obj.sNegative = {}; obj.presentNQ2 = ''; obj.presentQ2 = ''; obj.pastNQ2 = ''; obj.pastQ2 = ''; switch(obj.base){ case 'will':obj.presentN = obj.pastN = "will not";obj.presentNS = obj.pastNS = "won't";break; case 'would':obj.presentN = obj.pastN = "would not";obj.presentNS = obj.pastNS = "wouldn't";break; case 'can':obj.presentN = obj.pastN = "cannot";obj.presentNS = obj.pastNS = "can't";break; case 'could':obj.presentN = obj.pastN = "could not";obj.presentNS = obj.pastNS = "couldn't";break; case 'must':obj.presentN = obj.pastN = "must not";obj.presentNS = obj.pastNS = "mustn't";break; case 'may':obj.presentN = obj.pastN = "may not";obj.presentNS = obj.pastNS = "may not";break; case 'might':obj.presentN = obj.pastN = "might not";obj.presentNS = obj.pastNS = "might not";break; case 'shall':obj.presentN = obj.pastN = "shall not";obj.presentNS = obj.pastNS = "shan't";break; case 'should':obj.presentN = obj.pastN = "should not";obj.presentNS = obj.pastNS = "shouldn't";break; case 'need':obj.presentN = obj.pastN = "need not";obj.presentNS = obj.pastNS = "needn't";break; case 'dare':obj.presentN = obj.pastN = "dare not";obj.presentNS = obj.pastNS = "daren't";break; case 'used to':obj.presentN = obj.pastN = "used not to";obj.presentNS = obj.pastNS = "used not to";break; case 'had better':obj.presentN = obj.pastN = "had better not";obj.presentNS = obj.pastNS = "had better not";break; case 'ought to':obj.presentN = obj.pastN = "ought not to";obj.presentNS = obj.pastNS = "ought not to";break;}obj.presentQ1 = obj.paseQ1 = obj.base; obj.presentNQ1 = obj.paseNQ1 = obj.presentNS; obj.toPositive = function(){ this.val = this.base;}obj.toNegative = function(){ this.val = this.sNegative.present;}obj.toPositive();}function n(attrs,obj){ if(attrs.nBaseId != u && words['n'][wordIdMap[attrs.nBaseId].word][wordIdMap[attrs.nBaseId].index] != u){ var tempW = clone(words['n'][wordIdMap[attrs.nBaseId].word][wordIdMap[attrs.nBaseId].index]);}else if(attrs.singular != u && words['n'][attrs.singular] != u){ var tempW = clone(words['n'][attrs.singular].rand());}else{ var tempW = clone(words['n'][wordmap['n'].rand()].rand());}obj.singular = tempW.singular; obj.plural = tempW.plural; if(tempW.ntype != u){ obj.ntype = tempW.ntype;}else{ obj.ntype = ntypes.rand();}attr(obj,attrs); obj.tp = obj.pn.tp; if(obj.isPlural){ obj.val = obj['plural'];}else{ obj.val = obj['singular'];}}function be(attrs,obj){ attr(obj,attrs); obj.base = "be"; obj.perfect = "been"; obj.ing = "being"; obj.three = "is"; obj.pastthree = "was"; obj.presentNQ2 = ''; obj.presentQ2 = ''; obj.pastNQ2 = ''; obj.pastQ2 = ''; obj.changePpl=function(ppl,plural){ if(ppl == u){ ppl = nPpl.rand();}if(plural == u){ plural = tf();}if(plural || ppl == 2){ this.present = "are"; this.past = "were"; this.presentN = "are not"; this.pastN = "were not"; this.presentNS = "aren't"; this.pastNS = "weren't";}else{ if(ppl == 3){ this.present = "is"; this.past = "was"; this.presentN = "is not"; this.pastN = "was not"; this.presentNS = "isn't"; this.pastNS = "wasn't";}else if(ppl == 1){ this.present = "am"; this.past = "was"; this.presentN = "am not"; this.pastN = "was not"; this.presentNS = "am not"; this.pastNS = "wasn't";}}this.pastNQ1 = this.pastNS; this.pastQ1 = this.past; this.presentNQ1 = this.presentNS; if(this.presentNQ1 == 'am not'){ this.presentNQ1 = 'am'; this.presentNQ2 = 'not';}this.presentQ1 = this.present; this.isPlural = plural; this.third = ppl; this.val = this[this.vform];}obj.to = function(vform){ this.val = this[vform];}obj.changePpl(obj.third,obj.isPlural); obj.to(obj.vform);}function gen(attrs,obj){ attr(obj,attrs); if(attrs.baseId != u && words['v'][wordIdMap[attrs.baseId].word][wordIdMap[attrs.baseId].index] != u){ var tempW = clone(words['v'][wordIdMap[attrs.baseId].word][wordIdMap[attrs.baseId].index]);}else if(attrs.base != u && words['v'][attrs.base] != u){ var tempW = clone(words['v'][attrs.base].rand());}else if(obj.vpname != u && vpmap[obj.vpname]!=u){ var vpv = vPatterns[vpmap[obj.vpname]].v.rand(); var tempW = clone(words['v'][vpv.spell][vpv.index]);}else{ var tempW = clone(words['v'][wordmap['v'].rand()].rand());}obj.base = tempW.base; obj.three = tempW.three; obj.past =obj.pasttherr = tempW.past; obj.baseNS = "don't "+tempW.base; obj.threeNS = "doesn't "+tempW.base; obj.pastNS =obj.pasttherrNS = "didn't "+tempW.base; obj.baseN = "do not "+tempW.base; obj.threeN = "does not "+tempW.base; obj.pastN =obj.pasttherrN = "did not "+tempW.base; obj.perfect = tempW.perfect; obj.ing = tempW.ing; obj.presentNQ2 = obj.base; obj.presentQ2 = obj.base; obj.pastNQ2 = obj.base; obj.pastQ2 = obj.base; obj.pastNQ1 = "didn't"; obj.pastQ1 = 'did'; if(tempW.pres != u){ obj.pres = tempW.pres;}obj.changePpl=function(ppl,plural){ if(ppl == u){ ppl = nPpl.rand();}if(plural == u){ plural = tf();}if(ppl == 3 && plural== false){ this.present = this.three; this.presentN = this.threeN; this.presentNS = this.threeNS;}else{ this.present = this.base; this.presentN = this.baseN; this.presentNS = this.baseNS;}this.isPlural = plural; this.third = ppl; this.val = this[this.vform]; this.presentNQ1 = this.presentNS; this.presentQ1 = this.present;}obj.to = function(vform){ this.val = this[vform];}obj.changePpl(obj.third,obj.isPlural); obj.to(obj.vform);}function cst(attrs,obj){ if(attrs.val == u){ obj.val = 'it';}else{ obj.val = attrs.val;}}