EnNounPhrase Module of First Working AGI

EnNounPhrase module of the

First Working AGI Mind in JavaScript

MindForth for robots -- ghost.pl for webservers


1. Diagram of the EnNounPhrase Mind-Module


   /^^^^^^^^^\ EnNounPhrase finds noun or pronoun  /^^^^^^^^^\
  /   EYE     \              _____________        /   EAR     \
 /             \    | | |   /             \      / auditory    \
|               |   | | |  (    EnThink    )    |  memory       |
|   _______     |   | | |   \_____________/     |  channel      |
|  /image  \    |   | | |     |         |       |               |
| / percept \---|-----+ |   __V___      |       |               |
| \ engram  /   |  a| | |  /EnNoun\     |       |               |
|  \_______/    |  b|c| | / Phrase \----|-------|--"robots"     |
|               |  s|o|f|( subject  ) __V___    |               |
|   visual      |  t|n|i| \________/ /EnVerb\   |               |
|               |  r|c|b|           ( Phrase )--|--"save"       |
|   memory      |  a|e|e|    _______ \______/   |               |
|               |  c|p|r|   /EnNoun \/  |       |               |
|   channel     |  t|t|s|  / Phrase  \  |       |               |
|               |   | | | ( indirect  )-|-------|--"people"     |
|               |   | | |  \ object  /  |       |               |
|               |   | | |   \_______/ __V___    |               |
|   _______     |   |_|_|            /EnNoun\   |               |
|  /fresh  \    |  / Psy \          / Phrase \  |               |
| / image   \   | /concept\        (  direct  )-|--"work"       |
| \ engram  /---|-\ array /         \ object /  |               |
|  \_______/    |  \_____/           \______/   |               |


2. Purpose

EnNounPhrase finds an English noun or pronoun to serve as the subject of a sentence or as the indirect or direct object of a verb being thought by EnVerbPhrase. EnNounPhrase may also call EnPrep to insert a preposition; EnArticle to insert "a" or "the" before a noun; or EnAdjective to insert an English adjective describing a noun.

3. Function

For the subject of a sentence of thought, EnNounPhrase typically finds the most active noun-concept in the Psy array of concepts. The English verb-phrase module EnVerbPhrase may call the EnNounPhrase module for both an indirect object of a verb and for a direct object. If an AI Mind embodied in a robot can recognize and name objects with a VisRecog module, the noun naming the recognized object may go directly into the slot for a direct object in a sentence being generated. The robot might say, "I see a dog." VisRecog may first identify the concept being recognized and then call EnNounPhrase to express the noun of the concept in a thought.

When the EnNounPhrase module must recall a noun or a pronoun in response to an external query, such as, "Who are you," first the SpreadAct module will use the $qv1psi variable to find and activate the needed noun or pronoun and the $qv2psi variable to identify the verb associated with the target noun, first in the query itself, and then in the response to the query. Since both the noun and the verb are combined in the search for memories responding to the query, the AI will not recall some random statement about the subject of the query, but will instead recall any available memory expressing both the subject of the query and the verb expressed in the query. For the query "Who are you", the AI must find both the ego-concept "I" and the be-verb to be expressed as "am", as in "I am."


4. Code of EnNounPhrase() from ghost.pl First Working AGI in Perl

sub EnNounPhrase() {  # http://ai.neocities.org/EnNounPhrase.html
# print "\n EnNPhr: vlock= $verblock prejux= $prejux jux= $jux \n";  # 2018-07-05: TEST
# print "\n EnNPhr: vlock= $verblock negjux= $negjux jux= $jux \n";  # 2018-07-06: TEST
  $aud = 0;  # 2018-06-28: safety measure.
  $act = 0;  # 2016mar29; 2016apr27: so comparisons may be higher.
  $audjuste = 0;  # 2016feb12: prevent carry-over
  $defact = -64;  # 2016apr13: for default comparisons with "701=I"; 
  $motjuste = 0;  # 2016feb12: 
  $nphrpos = 5;   # 2017-09-03: a default setting of noun for EnArticle(). 
  $subjpsi = 0;   # 2016jun28: how can there already be a subject-psi? TEST
  my $tsels = 0;  # 2016may25: de-globalize the time-of-selection-of-subject.
  if ($verblock > 0) {  # 2016apr13: positive verblock?
    my @k=split(',',$psy[$verblock]);  # 2016apr13: inspect t=verblock row;
    $nounlock = $k[13];  # 2017jun10: dirobj tkb becomes nounlock value; BUGFIX
    $subjnum = $k[8];    # 2017-06-10: from number of verb; BUGFIX
  }  # 2016apr13: end of test for a positive verblock;
  if ($nounlock > 0) {  # 2016apr13: already a nounlock? 
    $dirobj = 1;  # 2016apr20: nounlock is specifically for a direct object.
    $subjectflag = 0;  # 2016apr20: needed for conditional tests below;
    my @k=split(',',$psy[$nounlock]);  # 2016apr13: inspect t=nounlock row;
    $motjuste = $k[1];  # 2017jun08: in case a search is needed for non-zero $rv
    $act = $k[3];   # 2017jun08: let activation-level play its role here;
    if ($k[7] == 4) {   # 2017jun08: if acc. case as for any nounlock;
      if ($k[14] > 0) {     # 2017-09-03: if there is a positive recall-vector...
        $nphrpos = $k[6];   # 2017-09-03: find part-of-speech for EnArticle
        $aud = $k[14];      # 2017-09-03: find positive $rv; 
      }  # 2017-09-03: pre-ELSE end of test for a positive recall-vector
    } else {  # 2017jun11: if only a zero $rv $k[14] is found...
      for (my $i=$t; $i>$midway; $i--) {  # 2016apr20: search backwards in time.
        @k=split(',',$psy[$i]);  # 2016apr20: inspect @psy flag-panel
        if ($motjuste == $k[1]) {  # 2017jun08: find motjuste for sake of rv
          if ($dirobj == 1 && $k[7] == 4) {   # 2017jun08: direct object?
            if ($k[14] > 0) { $nphrpos = $k[6] }  # 2017-09-03: for EnArticle.
            if ($k[14] > 0) { $aud = $k[14] }  # 2017jun08: find positive $rv; 
            if ($k[14] > 0) { last }  # 2017jun08: exit loop if $rv is found.
          }  # 2016apr20: end of test for direct object and accusative case.
          if ($k[14] > 0) { $nphrpos = $k[6] }  # 2017-09-24: for EnArticle.
          if ($k[14] > 0) { $aud = $k[14] }  # 201709-24: find positive $rv; 
          if ($k[14] > 0) { last }  # 2017-09-24: exit loop if $rv is found.
        }  # 2016apr20: end of test to find $motjuste with valid $rv.
      }  # 2016apr27: end of for-loop in search of a positive recall-vector.
    }  # 2017sep03: end of else-clause for typically a pronominal $rv.
    $actpsi = $k[1];  # 2017-06-17: send direct object into SpreadAct()
  }  # 2016apr13: end of test for a positive nounlock;
  if ($nounlock == 0) {  # 2016apr16: if nouns are free to compete...
    $subjectflag = 1;  # 2016mar29: a default until countermanded.  
    $dba = 1;  # 2017-06-11: default nominative until countermanded.  
    if ($dirobj == 1) { $subjectflag = 0 }  # 2016mar29: countermanding default
    for (my $i=$t; $i>$midway; $i--) {  # 2016apr30: include input for topical response
      my @k=split(',',$psy[$i]);  # 2016mar15: inspect @psy knowledge-nodes.
      if ($k[2] eq "en") {  # 2016mar15: select only English words
        if ($k[6]==5 || $k[6]==7) {  # 2017jun08: select $pos noun or pronoun
          if ($k[13] > 0 ) {  # 2017jun8: retrieve ideas, not single words.
            if ($k[3] > $act) {   # 2017jun08: k3 activation as criterion. 
              $motjuste = $k[1];  # 2017jun08: Select the most active concept.
              $svo1 = $k[1];      # 2017-06-08: keep track of subject.
              $mjact = $k[3];  # 2017jun08: if too low, motjuste defaults to "I"
              if ($k[3] > $act && $k[12] > 0) {  # 2017jun8: if k1-psi has k12-seq
                $verblock = $k[13];  # 2017jun08: assign $tkb value to verblock.
# print "EnNP: assigning vlock= verblock= i= $i k1= $k[1] nlock= $nounlock \n"; # 2018-07-06
# print "EnNP: i= $i VL= $verblock= k1= $k[1] k5= $k[5] negjux= $negjux jux= $jux  \n"; # 
              }  # 2017jun11: end of test for a k1-subject with a k12-seq.
              if ($k[3] > $act && $k[13] > 0) {  # 2017jun11: if k1-psi has k13-tkb
                $verblock = $k[13];  # 2017jun11: assign $tkb value to verblock.
              }  # 2017jun11: end of test for a k1-subject with a k13-tkb.
              if ($dirobj == 1) { $actpsi = $k[1] }  # 2017jun08
              $subjpsi = $motjuste;  # 2016apr10: for selection of verb-form.
              $snu = $k[8];  # 2017jun08: for parameter in verb-selection; 
              if ($k[14] > 0) {  # 2017-09-03: if there is a positive recall-vector...
                $nphrpos = $k[6];   # 2017-09-03: for sake of EnArticle.
                $audjuste = $k[14]; # 2017sep03: temporary recall-vector for Speech
                $aud = $k[14]; # 2018-06-28: recall-vector for Speech()
              }  # 2018-06-28: end of test for auditory recall-vector.
              $tseln = $i;        # 2016mar29: use time-point for inhibition. 
              $tsels = $i;        # 2016apr17: use time-point for inhibition. 
              $act = $k[3];       # 2017jun08: noun must have higher act to win
            }  # 2016feb12: end of test for a higher activation $act
          }  # 2017dec06: end of test for a k[13] tkb verblock
        }  # 2016feb17: end of test for noun or pronoun as subject
      }  # 2016feb17: end of test for human language code $hlc == "en"
    }  # 2016mar13: End of (for loop) searching for most active "motjuste"
  } # 2016apr16: end of test for absence of a $nounlock.
  my @k=split(',',$psy[$tsels]);  # 2016apr17: inspect subject at time of selection;
  $psy[$tsels]="$k[0],$k[1],$k[2],-90,$k[4],$k[5],$k[6],"  # 2017-06-10: BUGFIX
  . "$k[7],$k[8],$k[9],$k[10],$k[11],$k[12],$k[13],$k[14]"; # 2017-06-10: comma BUGFIX
  # 2016jun28: Above line inserts inhibition more than twice what SpreadAct imposes. 
  if ($subjectflag == 0) {  # 2016apr13: i.e., dir.obj or pred.nom;
    if ($nounlock > 0) {  # 2016apr13: if verb is locked to a particular $seq...
      my @k=split(',',$psy[$nounlock]);  # 2016apr13: inspect t=nounlock row;
      $motjuste = $k[1];  # 2017jun08: nounlock psi pre-empts search.
      $act = $k[3];  # 2017jun08: let activation-level play its role here;
      if ($k[6] == 5) {  # 2017-09-03: if nounlock part of speech is 5=noun
        $nphrpos = 5;    # 2017-09-03: for sake of EnArticle.
        $qv1psi = $k[1]; # 2017-09-03: let direct object go to SpreadAct. 
      }  # 2017-09-03: end of test for only a noun to go into SpreadAct.
      $aud = $k[14]; # 2017jun08: k14 recall-vector to auditory engram.  
    }  # 2016apr13: end of test for a positive nounlock.
  }  # 2016apr13: end of test for not-a-subject before using ELSE
  if ($aud == 0) {  # 2018-06-28: seek outside of rv-less silent inference...
    for (my $i=$t; $i>$midway; $i--) {  # 2016mar27: search backwards in time.
      my @k=split(',',$psy[$i]);  # 2016mar27: inspect @psy flag-panel
      $act = $k[3];  # 2017jun08: let activation-level play its role here;
      if ($motjuste == $k[1]) {  # 2017jun08: find motjuste for sake of rv
        if ($subjectflag == 1 && $k[7] == 1) {   # 2017jun08: subject?
          if ($k[14] > 0) { $aud = $k[14] }  # 2017jun08: find positive $rv; 
          if ($k[14] > 0) { last }  # 2017jun08: exit loop if $rv is found.
        }  # 2016apr01: end of test for subject and for nominative case.
        if ($dirobj == 1 && $k[7] == 4) {   # 2017jun08: direct object?
          if ($k[1] > 0) { $qv4psi = $k[1] }  # 2017-12-12: for inserting "AN".
          if ($k[14] > 0) { $nphrpos = $k[6] } # 2017-09-01: set POS for EnArticle.
          if ($k[14] > 0) { $aud = $k[14] }  # 2017jun08: find positive $rv; 
          if ($k[14] > 0) { last }  # 2017jun08: exit loop if $rv is found.
        }  # 2016apr01: end of test for direct object and accusative case.
      }  # 2016mar27: end of test to find $motjuste with valid $rv.
    }  # 2016mar27: End of (for loop) searching through @psy conceptual array. 
  }  # 2016mar27: end of else-clause for when recall-vector is zero.
  if ($nounlock == 0) {  # 2016apr07: if no nounlock override; 
    if ($mjact < 20) {  # 2016jun18: if no subject active enough for chain-of-thought
      if ($subjectflag == 1) {  # 2016apr07: default to "I" only as subject
        $actpsi = 701;  # 2016apr29: send 701=I ego-concept into SpreadAct()
        $motjuste = 701;  # 2016apr07: 701=I default concept of AI Mind
        for (my $i=$t; $i>$midway; $i--) {  # 2016apr07: search for "I"
          my @k=split(',',$psy[$i]);  # 2016apr07: examine @psy
          if ($k[1]==701 && $k[13]>0) { # 2017jun08: I=701 with $tkb verblock?
            if ($k[3] > $defact) {  # 2017jun08: if higher k3 act is found;
              $tseln = $i;  # 2016apr07: retain time of motjuste; 
              $tsels = $i;  # 2016may25: retain time of English subject;
              $actpsi = $k[1];    # 2017jun08: psi with activation to spread
              $defact = $k[3];    # 2017jun08: dynamic metric;
              $verblock = $k[13]; # 2017jun08: k13 $tkb as verblock; 
              $aud = $k[14];      # 2017jun08: recall-vector for auditory engram
            }  # 2016apr07: end of test for higher-act ego-concept;
          }  # 2016apr07: end of test for "701=I" with seq-check;
        }  # 2016apr07: end of search for least-inhibited "701=I"; 
        $dba = 1;        # 2016apr07: From RuAi; subject requires nom. case; 
        $nphrnum = 1;    # 2016apr07: for EnArticle() and EnVerbPhrase();
        $nphrpos = 7;    # 2016apr07: prevent article "A" with "I";
        $prsn = 1;       # 2016apr07: for use elsewhere; 
        $subjnum = 1;    # 2016apr07: for use elsewhere;
        $subjpsi = 701;  # 2016apr07: for use elsewhere;
        $topic = 701;    # 2016apr07: for question-asking modules; 
        for (my $i=$t; $i>$midway; $i--) {  # 2016apr07: parameters for 701=I.
          my @k=split(',',$psy[$i]);  # 2016apr07: examine @psy
          if ($k[1] == 701) {  # 2017jun08: if 701=I is found;
            if ($k[7] == 1) {  # 2017jun08: k7/dba must be nominative=1; 
              $audjuste = $k[14];  # 2017jun08: "I" recall-vector;
              $aud = $k[14];  # 2017jun08: "I" recall-vector for Speech()
              if ($k[14]>0) { $aud=$k[14]; last }  # 2017jun08: insurance
            }  # 2016apr07: end of test for nominative "I"; 
          }  # 2016apr07: End of search for 701=I;
        }  # 2016apr07: end of 701=I search based on parameters.
      }  # 2016apr07: end of test for "I" to become subj. not obj.
    }  # 2016apr07: end of test for low activation warranting a default
  }  # 2016apr07: end of test for absence of pre-ordained nounlock;
  $unk = $aud;  # 2017-08-31: preserve value across call to EnArticle().
  if ($dirobj == 1) {   # 2017-09-03: if thinking of a direct object...
    if ($nphrpos == 5) {  # 2017-09-03: only nouns, not adjectives or pronouns.
      my @aud=split(',',$ear[$aud]);  # 2017-12-12: expose first @ear value
      if ($aud[0] eq "A") { $anset = 65 }  # 2017-12-12: If vowel "A";
      if ($aud[0] eq "E") { $anset = 69 }  # 2017-12-12: If vowel "E";
      if ($aud[0] eq "I") { $anset = 73 }  # 2017-12-12: If vowel "I";
      if ($aud[0] eq "O") { $anset = 79 }  # 2017-12-12: If vowel "O";
      if ($aud[0] eq "U") { $anset = 85 }  # 2017-12-12: If vowel "U";
      EnArticle()         # 2017-12-11: module for thinking an English article.
    }  # 2017-09-03: end of test for a 5=noun noun-phrase part-of-speech
  }  # 2017-09-03: end of tests for calling the EnArticle module. 
  $aud = $unk;  # 2017-08-31: restore value after call to EnArticle().
  $unk = 0;     # 2017-08-31: reset for safety. 
  Speech();  # 2016feb13: speak the word starting at the $aud time. 
  @k=split(',',$psy[$tsels]);  # 2016jun24: inhibit the subject just spoken.
  $psy[$tsels]="$k[0],$k[1],$k[2],-32,$k[4],$k[5],$k[6],"  # 2017-06-10: BUGFIX
  . "$k[7],$k[8],$k[9],$k[10],$k[11],$k[12],$k[13],$k[14]"; # 2017-06-08: concatenator
  $dirobj = 0;    # 2016apr12: reset for safety
  $mjact = 0;     # 2016apr27: reset for safety.
  $motjuste = 0;  # 2016apr25: reset for safety. 
}  # 2016feb21: EnNounPhrase() returns to English EnThink() module


5. Troubleshooting and Robotic Psychosurgery

5.1.a. Symptom: (Something goes wrong.)
5.1.b. Solution: (AI Mind Maintainer devises solution.)


6. Variables for First Working Artificial General Intelligence

$motjuste -- (from French) best word for inclusion in a thought.


7. Future Development


8. Resources


Please see also

http://mind.sourceforge.net/n-phrase.html


9. AiTree of First Working AGI Mind-Modules


Return to top; or to
javascript subreddit for AI Mind discussion;
Forth subreddit for MindForth discussion;
Perl subreddit for ghost.pl AI Mind Maintainers.