?? javascript
字號(hào):
pov = "*"; // point-of-view "internal" symbol
t = (t + 1); // increment time "t"
onset = (blankt + 1); // 23jan2001: from Mind.Forth AI.
if (onset == t) beg = 1; // ...if a word is beginning...
else beg = 0; // i.e., not a word-beginning
if (pho != 32) {
len = (len +1); // as in Audition()
STM(); // as if user were typing in characters.
}
if (pho == 32) Retro();
} // end of reEntry()
// Voice() is called by Speech() etc.
function Voice() {
document.all.nuntius.innerHTML = message;
outputplus = ("<font size='+3' color='navy'>" + output + "<\/b><\/font>");
document.all.mouth.innerHTML = outputplus;
return;
}
// Speech() is called by nounPhrase() or Predicate().
function Speech() {
ctu = 1; // as every words starts, continuation = 1.
onset = rv; // the onset of a word is its recall-vector
do { // Moncur p. 98: test only at end of loop.
audMemChan[rv].audRecall(); // a series of recall-vectors
pho = gram1; // pho(neme) is the stored ASCII character
output += gram1; // build up the string of a word
ctu = gram5; // panel item #5 is "continuation?"
reEntry(); // output of the mind reenters the mind.
rv = (rv + 1); // read audEngrams one by one.
}
while (ctu == 1); // and one final loop while _not_
if (ctu == 0) { // immediately after a zero "ctu"
pho = 32; // ASCII 32 for SPACE-BAR
reEntry(); // send a blank space to reEntry()
}
output += " "; // for one space after any word
Voice(); // speak the output
} // end of Speech()
// nounPhrase() is called beneath English()
// by either Subject() or Predicate().
function nounPhrase() {
opt = 5; // look for option five (a noun)
unk = 0;
mt = 0;
motjuste = 0;
rv = 0;
act = 0;
flushVector();
for (i = t; i>midway; --i) {
enLexicon[i].enExam(); // inspect English nodes
if (en2 > 0) act = en2; // obtain "act" if positive
if (en4 == 5) { // if grammar category is "noun"
if (act > unk) {
mt = en1; // get move-tag of the noun
rv = en6; // get the auditory recall-vector
unk = act; // to test for an even higher activation
motjuste = mt; // select a tentative motjuste
} // end of if-clause
} // end of if-clause
} // end of loop
meme = mt; // for use in psiDamp
psiDamp(); // to de-activate Psi concepts
enDamp(); // to de-activate English concepts
Speech(); // 1feb2001: without time-delay
psiDamp(); // to de-activate Psi concepts
// Say a SPACE-BAR 32 ?
act = 0;
} // end of nounPhrase()
// Subject is called from English()
// to find and express a subject.
function Subject() {
nounPhrase();
pho = " ";
return;
} // end of Subject()
// Predicate is called from English()
// to find and express a verb +/- object.
function Predicate() {
opt = 8; // look for option eight (a verb)
unk = 0;
mt = 0;
motjuste = 0;
par = 2;
flushVector(); // to move deep Psi concepts up to English
en4 = 0; // 3feb2001 -- a safety measure before looping.
for (i = t; i>midway; i--) {
enLexicon[i].enExam(); // inspect English nodes
if (en4 == 8) { // only look at verbs, for Predicate()
if (en2 > unk) {
mt = en1; // store move-tag of verb
rv = en6; // auditory recall-vector
unk = en2; // to test for higher "act(ivation)"
motjuste = mt;
} // end of if-clause looking for high activation
} // end of if-clause checking for verb-8's
else continue; // try to avoid looking at non-verbs.
} // end of loop cycling back through English lexicon
meme = mt;
psiDamp(); // to de-activate Psi concepts
Speech();
psiDamp(); // to de-activate Psi concepts
mt = motjuste;
enDamp(); // to de-activate English concepts
pho = " ";
// Audition(); // 23feb2001: removing for sake of cutOut()
par = 3;
// make a SPACE-BAR 32?
nounPhrase();
} // end of Predicate()
// English() is called by Think() and is
// the structure of an English sentence.
function English() {
html = "";
output = ""; // 1feb2001: initial precaution
attn = 1; // turn attention low and inwards.
tov = t; // time-of-voice for echoing input.
Subject();
Predicate();
t = (t+1); // advance time to separate reentered words.
blankt = (blankt + 1); // 21feb2001: a timid bug-fix?
enDamp(); // 7feb2001: deactivate the English lexicon.
audDamp(); // 11feb2001 -- protect Comparator()?
// 28jan2001: The next line turns attention back on
// after the AI has responded to a line of user input.
// The line of code may belong properly in Think().
attn = 3;
}
// Think() is called by the main aLife() function
// if "attn" has dropped from 3 down to "2" --
// typically because user entry has called "CR()".
function Think() {
if (attn < 3) {
English();
}
}
// freeWill() is called from aLife() as a stub
// to show the future organization of advanced AI,
// and as a delaying mechanism in the aLife() loop.
function freeWill() {
if (death == false) {
document.forms[0].ear.focus(); // await input
message = "Free will -- waiting for user input.";
}
else {
deadEnd(); // an extra security precaution
} // end of else-clause
return;
}
// Motorium() is called from aLife() as a stub
// to show the future organization of advanced AI.
// AI in JavaScript is not as suitable as Mind.Forth
// for implementing a robotic "Motorium()" module.
function Motorium() {
if (death == false) {
document.forms[0].ear.focus(); // await input
message = "Motorium -- build me a robot.";
}
else {
deadEnd(); // an extra security precaution
} // end of else-clause
return;
}
// aLife() is the main loop:
function aLife() {
// Sensorium(); // basically a stub at first.
// Emotion(); // a stub, but important.
if (t > 40) nonce = (t - 40); // for use in Troubleshoot
if (t > (cns-32)) { // if within 32 units of "cns" capacity
message = "WARNING! Click Refresh. Brain almost full!";
} // end of if-clause
if (attn < 3) {
Think();
} // end of if-clause checking level of attention.
// freeWill(); // a stub
// Motorium(); // a stub
if (t > cns) death = true; // mindcore Psi is full
// Security(); // for a loop back to aLife()
if (hardcopy == true) {
Transcript(); // to make a hardcopy print-out possible
} // end of if-clause to call Transcript()
if (trouble == true) {
Troubleshoot(); // to show contents of arrays
} // end of if-clause to call Troubleshoot()
TID=window.setTimeout("cutOut();",59000);
} // end of aLife loop
// cutOut() is called from aLife() so that
// user input in Audition() has chance to
// prevent an automatic Tutorial display.
function cutOut() {
if (conversing == false) Homunculus();
}
// Homunculus() is called from aLife()
// to run a Tutorial display show.
function Homunculus() {
// alert('Now in Homunculus'); // test; remove.
output = "Waiting for input...";
Voice();
if (tutor == true) PhD(); // to cycle through "clues".
Security(); // to loop around again.
} // end of Homunculus()
</SCRIPT>
<!--*********AI code is above; visible Mind is below**********-->
</HEAD>
<BODY bgColor=#fffacd onload=Bootstrap()>
<CENTER>
</CENTER>
<CENTER>
<A title="Load the directory of archival file copies." target=_new
href="http://www.geocities.com/mentifex/jscript.html">JavaScript版本人工智能</A> 應(yīng)用于<B>MSIE
4.01</B>以上版本.
</CENTER>
<CENTER>
要獲取詳細(xì)信息請(qǐng)通過(guò)代理連接<A title="The JSAIMIND is based on Mind.Forth AI."
style="TEXT-DECORATION: none" target=_new
href="http://www.geocities.com/mentifex/mind4th.html">http://www.geocities.com/mentifex/mind4th.html</A>
</CENTER>
<CENTER>
本頁(yè)更新于2001年2月24日 <a href="http://swnet.onchina.net" target="_blank">編程無(wú)限</a>整理
</CENTER>
<FORM
onsubmit="if (this.submitted) return true; else {CR(); return false;};">
<B>輸入英文然后按[回車]</B><BR>
<INPUT
onkeydown=Audition() size=80 name=ear> </FORM>
<DIV id=mouth style="POSITION: static; BACKGROUND-COLOR: aqua">人工智能輸出將顯示在這里</DIV>
<DIV id=nuntius
style="POSITION: static; BACKGROUND-COLOR: lightgreen">系統(tǒng)信息將顯示在這里</DIV>
<FIELDSET><LEGEND><FONT color=red><B>控制板</B></FONT></LEGEND>
<FORM name=modes><INPUT onclick=HCI() type=checkbox name=cb2>
Transcript or[對(duì)話記錄]
<INPUT onclick=HCI() type=checkbox name=cb3>
Troubleshoot[排除故障]
<INPUT onclick=PhD()
type=checkbox CHECKED name=cb4>
Tutorial[訓(xùn)練]
<INPUT onclick=Shutdown();
type=checkbox name=cb5>
<FONT color=red><B>HALT</B></FONT>[暫停]
<INPUT
onclick=Destroy(); type=checkbox name=cb6>
Terminate[結(jié)束]<BR>
</FORM></FIELDSET>
<NOSCRIPT>
<P>本程序需要瀏覽器JAVASCRIPT支持!<BR>
</NOSCRIPT>
<SCRIPT language=JavaScript>
// The following code activates the INPUT FORM cursor:
document.forms[0].ear.focus();
</SCRIPT>
<DIV id=teacher style="POSITION: static; BACKGROUND-COLOR: yellow">人工智能程序模型:(已實(shí)現(xiàn)部分)</DIV>
<FONT color=navy size=+1><B><PRE> ___________ _______ ___________
/ visual \ / \ / auditory \
/ memory \ / English \ / memory \
| /--------|--------\ \ syntax /---|-------------\ |
| | recog-|nition | \_______/ | channel | |
| ___|___ | | | | ________ | |
| /image \ | ___V__ ____V__ | / \ | |
| / percept \ | / Psi \------/English\----|-/ audEngram\| |
| \ engrams /---|---/concepts\----/ lexicon \---|-\ phonemes / |
| \_______/ | \________/ \_________/ | \________/ |</PRE></B></FONT>
<DIV id=souvenir
style="WIDTH: 640px; POSITION: static; BACKGROUND-COLOR: lightyellow">對(duì)話記錄開始</DIV>
<DIV id=tabula
style="WIDTH: 640px; POSITION: static; BACKGROUND-COLOR: aqua">Unclick
Troubleshoot prior to clicking on Transcript. </DIV><!-- The Troubleshoot columns are present but invisible. -->
<DIV id=psicolumn
style="LEFT: 10px; WIDTH: 200px; POSITION: absolute; TOP: 600px; HEIGHT: 140px"></DIV>
<DIV id=encolumn
style="LEFT: 220px; WIDTH: 200px; POSITION: absolute; TOP: 600px; HEIGHT: 140px"></DIV>
<DIV id=audcolumn
style="LEFT: 430px; WIDTH: 200px; POSITION: absolute; TOP: 600px; HEIGHT: 140px"></DIV><!-- comments of the HTML variety:
Wed. "21feb01A.html" fixes a "blankt" bug that was causing
gaps in thoughts generated by the Artificial Mind; precludes
Transcript() and Troubleshoot() from overwriting each other;
solves problem of cumulative laser-printer overwrites.
Fri. "23feb01A.html" removes accumulated obsolete code.
File "23feb01B.html" re-establishes a main time-delay loop.
File "23feb01C.html" separates the PhD() from HCI() module.
Sat. "24feb01A.html" introduces a Tutorial curriculum.
(end of HTML comments) --><!-- text below generated by server. PLEASE REMOVE -->
</BODY></HTML>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -