EnNounPhrase Module of the

First Working Artificial General Intelligence

ghost.pl for webservers -- MindForth for robots


1. Diagram of the EnNounPhrase Mind-Module


   /^^^^^^^^^\               _____________         /^^^^^^^^^\
  /   EYE     \             /  EnThink    \       /   EAR     \
 /             \    | | |   \_____________/     / auditory    \
|               |   | | |   _____|________      |  memory       |
|   _______     |   | | |  (   Indicative )     |  channel      |
|  /image  \    |   | | |   \____________/      |               |
| / percept \---|-----+ |   __|___      |       |               |
| \ 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. Algorithm

3.A.1. Fetching a noun or pronoun as the subject of a thought.

For the subject of a sentence of thought, EnNounPhrase typically finds the most active noun-concept in the Psy array of concepts.

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."

3.A.2. Fetching the ego-concept "I" as the default concept for contemplation in a quiescent mind.

3.A.3. Leaving out the repetitious subject-noun from any additional phrase being joined together with a first phrase for a resulting compound sentence that may be replaced with a single one-phrase sentence containing one or more conjunctions.

The user may tell the AI Mind two things:

  • John has a house
  • John has a car
  • The user may then ask the AI:
  • What does John have
  • The ghost292.pl AI was able to respond with the following output:

    THE JOHN HAS THE HOUSE AND THE JOHN HAS THE CAR I UNDERSTAND YOU

    Suppose that we want the AI Mind to join two sentences together:

    JOHN HAS A HOUSE
    and
    JOHN HAS A CAR


    By not repeating the subject, we get:
    JOHN HAS A HOUSE
    and
    JOHN HAS A CAR


    By not repeating the subject and the verb, we get:
    JOHN HAS A HOUSE
    and
    JOHN HAS A CAR

    The AI coding task for ghost294.pl in Perl was how to get the sentence-generation modules to skip repeating the subject and skip repeating the verb. Note that even a human being will sometimes dawdle or linger while uttering the compound-setences, as in:
    "John has a house...and a car...and a lawnmower...and a canoe, etc."

    It was necessary to use one of the "chain" or "conCATenation" variables:

    
    our $catiobj = 0;   # 2019-01-28: concat-indirect-object for ConJoin() "AND".
    our $catdobj = 0;   # 2019-01-28: concat-direct-object for ConJoin() "AND".
    our $catsubj = 0;   # 2019-01-28: concat-subject for ConJoin() "AND".
    our $catverb = 0;   # 2019-01-28: concat-verb for ConJoin() "AND".
    

    We load the $catsubj variable inside the query-response code in the SpreadAct module. After the first phrase in response to a query, such as "JOHN HAS A HOUSE", the AI may check each activated idea for starting with $catsubj and for having $catverb in the second place. In that way, the various direct-objects may be isolated, introduced with "AND" from ConJoin, and sent into the Speech module for the output of a meandering, run-on response such as "JOHN HAS A HOUSE AND A CAR AND A BOAT AND A SLED AND A MOTORCYCLE". Such an AI output is like human speech, where the person states the basic premise before even thinking of all the nouns about to be concatenated with "AND" into the meandering response.

    Once the chain-variables are loaded with the concept-numbers of the items to be omitted for the syncopation or shortening of a compound-sentence, each item is omitted simply by letting Indicative call EnNounPhrase or EnVerbPhrase but preemptively using conditionals to make each module "return" to Indicative before sending a noun or a verb into the Speech module.

    3.B. Fetching a noun or pronoun as the direct object of a thought.

    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.

    3.C. Fetching a noun or pronoun as the object of a preposition.


    4. Code of EnNounPhrase() from ghost295.pl AI source code in Perl

    
    sub EnNounPhrase() {  # http://ai.neocities.org/EnNounPhrase.html
      $aud = 0;  # 2018-06-28: safety measure.
      $act = 0;  # 2016mar29; 2016apr27: so comparisons may be higher.
      $actpsi = 0;    # 2019-01-22: prevent carry-over within compound sentences.
      $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;
        $prsn = $k[7];       # 2018-09-30: for use in EnAuxVerb()
        $subjnum = $k[8];    # 2017-06-10: from number of verb; BUGFIX
        $nounlock = $k[13];  # 2017jun10: dirobj tkb becomes nounlock value; 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] == 1) {  # 2018-09-27: 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. 
                  $etc++;   # 2019-03-02: increment number of active ideas for ConJoin()
                  $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.
                  }  # 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.
      if ($whatcon > 0) {  # 2019-01-28: if SpreadAct() answers a what-query...
        if ($catsubj==$motjuste && $conj > 0) {  # 2019-01-28: after use of a conjunction...
          return;  # 2019-01-28: omit the subject-noun after the use of a conjunction.
        }  # 2019-01-28: end of test
      }  # 2019-01-28: end of test for SpreadAct() answering a what-query.
      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],"
      . "$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[0]>0 && $k[1]==701 && $k[13]>0) { # 2018-09-30: I=701 with non-zero $tru
                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 ($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
      $aud = $unk;  # 2017-08-31: restore value after call to EnArticle().
      $unk = 0;     # 2017-08-31: reset for safety. 
      EnAdjective();  # 2019-03-02: permit insertion of adjective before a noun.
      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],"
      . "$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. 
    }  # 2019-03-02: EnNounPhrase() returns to English EnThink() module
    


    EnNounPhrase of agi00086.F MindForth Robot AI source code in Win32Forth:
    
    :  EnNounPhrase ( http://ai.neocities.org/EnNounPhrase.html )
      0 mjact !  \ 2016aug14: initially default to zero; later calculate.
      0 pre !         \ 2016aug29: zero out to prevent carry-over
      0 prevtag !   \ 2016aug29: zero out to prevent carry-over
      0 rv !  \ 2016aug30: prevent carry-over in advance of any search. 
    \ whatcon @ 0 > IF  0 verblock ! THEN  \ 2018-07-09: if answering what-query...
    \ whatcon @ 0 > IF  0 verblock ! THEN  \ 2019-02-22: TEST
      verblock @ 0 > IF  \ 2016aug22: positive verblock? 
        verblock @   13 psy{ @  0 > IF  \ 2019-02-24: if "tkb" is positive...
          verblock @ 13 psy{ @ nounlock !  \ 2017jun15: one tkb from other tkb
        THEN  \ 2019-02-24: end of test for a positive "tkb" to become "nounlock".
      THEN  \ 2016aug22: end of test for a positive verblock
      nounlock @ 0 > IF  \ 2016aug22: if a verblock has yielded a nounlock...
        1 dirobj !  \ 2016aug21: nounlock is specifically for a direct object. 
        0 subjectflag !  \ 2016aug22: needed for conditional tests below;
        nounlock @  1 psy{ @  motjuste !  \ 2017jun15: in case of search for non-zero rv;
        nounlock @  1 psy{ @  actpsi !  \ 2018-06-19: send direct object to SpreadAct.
        nounlock @  3 psy{ @  act !  \ 2017jun15: let activation-level play its role here;
        nounlock @  6 psy{ @  nphrpos !  \ 2018-09-07: find part-of-speech for EnArticle
        nounlock @  7 psy{ @  4 = IF \ 2017jun15: if acc. case as for any nounlock; 
          nounlock @ 14 psy{ @ 0 > IF  \ 2017jun15: find positive rv; 
                 nounlock @  6 psy{ @ nphrpos !  \ 2017-09-01: for EnArticle
                 nounlock @  8 psy{ @ nphrnum !  \ 2018-09-07: for EnArticle
                 nounlock @ 14 psy{ @ rv !  \ 2017jun15
          ELSE  \  2018-11-24: if only a zero rv psi14 is found...
            midway @  t @  DO  \ 2016aug22: loop from present back to "midway".
                             I   1 psy{ @  motjuste = IF  \ 2017jun15: search on index "I"
                  I 14 psy{ @ 0 > IF  \ 2017jun15: if positive rv recall-vector...
                    I  6 psy{ @ nphrpos !  \ 2017-09-01: for sake of EnArticle.
                    I 14 psy{ @ aud !  \ 2017jun15: hold rv value as aud for SpeechAct
                    LEAVE  \ 21016aug22: one recall-vector is enough. 
                  THEN  \ 2016aug22: end of test for positive rv.
              THEN  \ 2016aug22: end of test to find motjuste with valid rv.
            -1 +LOOP   \ 2016aug22: end of search for a positive recall-vector.
          THEN  \ 2016aug22: end of test to find a direct-object recall-vector rv.
        THEN  \ 2016aug22: end of test for dba=4 accusative-case nounlock. 
      THEN  \ 2016aug22: end of test for a positive nounlock 
      nounlock @ 0 = IF  \ 2016aug22: if nouns are free to compete...
        1 subjectflag !  \ 2016aug22: a default until countermanded.  
        1 dba !  \ 2017-06-15: default nominative until countermanded.  
        dirobj @ 1 = IF 0 subjectflag ! THEN  \ 2016aug22: countermanding default.
        midway @  t @  DO  \ 2016aug22: loop from present back to "midway".
    
          I 6 psy{ @ 5 =  I 6 psy{ @ 7 = OR IF  \ 2017jun15: noun  or pronoun POS?
    
            I 13 psy{ @ 0 > IF  \ 2017jun15: retrieve ideas, not single words.
              I 3 psy{ @ act @ > IF  \ 2017jun15: using act(ivation) as criterion. 
                1 etc +!  \ 2019-02-20: increment number of active ideas for ConJoin.
                I 1 psy{ @ motjuste !  \ 2017jun15: select the most active concept.
                I 3 psy{ @ mjact !  \ 2017jun15: if too low, motjuste defaults to "I"
                I 3 psy{ @ act @ >  I 12 psy{ @ 0 > AND IF  \ 2017jun15: 
                  I 13 psy{ @ verblock !  \ 2018-12-18: assign tkb value to verblock.
                THEN  \ 2016aug22: end of test for higher-act concept with seq-psi.
                I 3 psy{ @ act @ >  I 13 psy{ @ 0 > AND IF  \ 2017jun15: positive tkb?
                  I 13 psy{ @ verblock !  \ 2017jun15: assign tkb value to verblock.
                THEN  \ 2017jun15: end of test for higher-act concept with tkb.
                I 6 psy{ @ 5 = IF  \ 2017jun15: if selected direct object is a 5=noun
                THEN  \ 2016sep01: end of test for only a noun to go into SpreadAct.
                I 8 psy{ @  nphrnum !  \ 2017jun15: NounPhrase number; 
                I 8 psy{ @ snu !  \ 2017jun15:  for parameter in verb-selection; 
                I 8 psy{ @ subjnum !  \ 2017jun15:  for parameter in verb-selection; 
                motjuste @ subjpsi !  \ 2016aug22: for selection of verb-form.
                I 3 psy{ @ act !  \ 2018-12-20: noun must have higher act to win.
                I 14 psy{ @ 0 > IF   \ 2017jun15: if there is a positive recall-vector...
                  I 14 psy{ @ audjuste !  \ 2017jun14: temporary recall-vector for Speech
                ELSE   \ 2016aug30: if there is no "rv"
                  midway @  t @  DO  \ 2016aug30: loop from present back to "midway".
                    I  1 psy{ @  motjuste @ = IF   \ 2017jun15: if same word as nounlock...
                      I 14 psy{ @ 0 > IF   \ 2017jun15: if positive rv...
                        I  6 psy{ @ nphrpos !  \ 2017-09-01: for sake of EnArticle.
                        I 14 psy{ @ audjuste !  \ 2017jun15: auditory recall-vector TEST
                       LEAVE    \ 2016aug30: one recall-vector is enough.
                      THEN   \ 2016aug30: end of test for positive psi12 rv.
                   THEN  \ 2016aug30: end of test for same word as nounlock motjuste
                 -1 +LOOP   \ 2016aug30: loop backwards 
                THEN   \ 2016aug30: end of test for non-interpreted positive psi12 "rv"  
                I tseln !   \ 2016aug22: use time-point of noun for inhibition. 
                I tsels !   \ 2016aug22: use time-point of subject for inhibition. 
                I 3 psy{ @ act !  \ 2018-12-18 BUGFIX: noun must have higher act to win.
              THEN  \ 2016aug22: end of test for a concept with higher activation. 
            THEN  \ 2016aug22: end of test for definite "tkb" related idea.  
          THEN  \ 2016aug22: end of test for noun or pronoun part-of-speech.
        -1 +LOOP   \ 2018-12-18: end of search for most active "motjuste"
      THEN  \ 2016aug22:  end of test for absence of a nounlock.
    \ whatcon @ 0 > IF  \ 2019-02-20: if SpreadAct answers a what-query...
    \ wasvcon @ 0 > IF  \ 2019-02-22: if SpreadAct answers what-AUX-SUBJ-VERB query...
      wasvcon @ 0 > dirobj @ 0 = AND IF  \ 2019-02-22: if SpreadAct answers what-AUX-SUBJ-VERB query...
         catsubj @  motjuste @ =  conj @ 0 > AND IF  \ 2019-02-20: after use of a conjunction...
        0 subjectflag !  \ 2019-02-22: prepare to select direct object next.
        1 dirobj !  \ 2019-02-22: prepare to select direct object next.
        EXIT  \ 2019-02-22: omit the subject-noun after the use of a conjunction.
        THEN  \ 2019-02-20: end of test for conditions warranting a conjoined thought.
      THEN  \ 2019-02-20: end of test for SpreadAct answering a what-query.
      -90 tsels @ 3 psy{ !  \ 2017jun15: insert inhibition at time of selection of subject. 
      subjectflag @ 0 = IF  \ 2016aug22: i.e., dir.obj or predicate nominative...
        0 rv !  \ 2016aug30: prevent carry-over in advance of any search. 
        nounlock @ 0 > IF  \ 2016aug22: if verb is locked to a particular seq...
          nounlock @ 1 psy{ @ motjuste !  \ 2017jun15: nounlock psi pre-empts search. 
          nounlock @ 6 psy{ @ 5 = IF  \ 2017jun15: if nounlock part of speech is 5=noun
            5 nphrpos !  \ 2017-09-01: for sake of EnArticle.
            nounlock @ 1 psy{ @ qv1psi !  \ 2017jun15: let direct object go to SpreadAct. 
          THEN   \ 2016sep01: end of test for only a noun to go into SpreadAct.
          nounlock @ 3 psy{ @ act !  \ 2017jun15: let activation-level play its role here;
          nounlock @ 8 psy{ @ nphrnum !  \ 2018-12-15 BUGFIX: for sake of EnArticle.
          nounlock @ 14 psy{ @ 0 > IF  \ 2017jun15: accept only non-zero "rv"...
            nounlock @  6 psy{ @ nphrpos !  \ 2017-09-01: for sake of EnArticle.
            nounlock @ 14 psy{ @ aud !  \ 2017jun15: set the auditory recall-vector
            nounlock @ 14 psy{ @ audjuste !  \ 2017jun15: auditory recall-vector TEST
          ELSE   \ 2016aug30: if no positive recall-vector is found...
            midway @  t @  DO  \ 2016aug30: loop from present back to "midway".
              I  1 psy{ @  motjuste @ = IF   \ 2017jun15: if same word as nounlock...
                I 14 psy{ @ 0 > IF   \ 2017jun15: if positive rv...
                  I  6 psy{ @ nphrpos !  \ 2017-09-01: set for sake of EnArticle.
                  I 14 psy{ @ aud !  \ 2017jun15: set the auditory recall-vector
                  I 14 psy{ @ audjuste !  \ 2017jun15: auditory recall-vector TEST
                 LEAVE    \ 2016aug30: one recall-vector is enough.
                THEN   \ 2016aug30: end of test for positive psi12 rv.
             THEN  \ 2016aug30: end of test for same word as nounlock motjuste
           -1 +LOOP   \ 2016aug30: loop backwards 
          THEN  \ 2016aug30: end of test for a non-zero recall-vector.
        THEN  \ 2016aug12: end of test for a positive nounlock. 
      THEN  \ 2016aug22: end of test for not-a-subject
      audjuste @ 0 > IF  \ 2016aug22: avoid "I" for "YOU" or "YOU" for "I"
        audjuste @ aud !  \ 2016aug22: for transfer into speech module
      ELSE  \ 2016aug22: if audjuste value is zero...
        midway @  t @  DO  \ 2016aug22: search backwards in time...
          I 3 psy{ @ act !  \ 2017jun15: let activation-level play its role here;
            I 1 psy{ @ motjuste @ = IF  \ 2017jun15: find motjuste for sake of rv
              I  6 psy{ @ nphrpos !  \ 2018-09-07: capture part-of-speech nphrpos
              I  7 psy{ @ 1 =  subjectflag @ 1 = AND IF  \ 2017jun15: subject?
                I 14 psy{ @ 0 > IF I 14 psy{ @ aud ! LEAVE THEN  \ 2017jun15: find rv.
              THEN  \ 2016aug22: end of test for subject and for nominative case.
                I  7 psy{ @ 4 = IF  \ 2017jun15: direct object?
                  I 14 psy{ @ 0 > IF   \ 2017-09-01: if positive auditory recall-vector...
                     I  6 psy{ @ nphrpos !  \ 2017-09-01: set POS for sake of EnArticle.
                     I 14 psy{ @ aud ! \ 2017-09-01: set the rv for SpeechAct.
                     LEAVE             \ 2017-09-01: one engram is enough.
                  THEN \ 2017jun15: d.o. rv
                THEN  \ 2016aug22: end of test for dba=4 accusative direct object. 
            THEN  \ 2016aug22: end of test to find motjuste with valid rv.
        -1 +LOOP   \ 2016aug22: end of search through psy{ conceptual array. 
      THEN  \ 2016aug22: 
      1 subjectflag !  \  2016aug14: initially default to zero; later calculate. 
      0 rv !  \ 2016aug30: prevent carry-over in advance of search. 
      nounlock @ 0 = IF \ 2016aug14: rudimentary selection of 701=I 
        mjact @ 20 < IF  \ 2016aug14: if no subject active enough for chain-of-thought
          subjectflag @ 1 = IF  \ 2016aug14: default to "I" only as subject
            701 motjuste !  \ 2016aug14: 701=I default concept of AI Mind
            7 nphrpos !     \ 2018-09-07: part-of-speech 7=pronoun ("I")
            midway @  t @  DO  \ 2016aug14: Use parameters to find "I".
              I 1 psy{ @ 701 = IF  \ 2017jun15: If 701=I is found;
                I  7 psy{ @ 1 = IF  \ 2017jun15: parameter dba=1?
                  I 3 psy{ @ -1 > IF  \ 2017jun15: if act is zero or higher...
                    I 13 psy{ @ 0 > IF  \ 2017jun15: positive verblock? 
                      I 13 psy{ @ verblock !  \ 2017jun15: hold the "tkb" verblock;
                        -64 I 3 psy{ +!    \ 2019-01-10: inhibit the particular ego-memory!
                        I 14 psy{ @ 0 > IF  I 14 psy{ @ audjuste !  THEN  \ 2017jun15
                        I 14 psy{ @ 0 = IF  \ 2017jun15: if re-interprerted "rv" = 0;
                          midway @  t @  DO  \ 2016sep18: loop from present back to "midway".
                            I  1 psy{ @ 701 = IF   \ 2017jun15: default 701=I?
                             I  7 psy{ @ 1 = IF  \ 2017jun15: parameter dba=1?
                              I 14 psy{ @ 0 > IF   \ 2017jun15: if positive rv...
                                I 14 psy{ @ aud !  \ 2017jun15: set the auditory recall-vector
                                I 14 psy{ @ audjuste !  \ 2017jun15: auditory recall-vector;
                                LEAVE    \ 2016sep18: one recall-vector is enough.
                              THEN   \ 2016sep18: end of test for positive psi12 rv.
                            THEN   \ 2016sep18: end of test for dba=1 nominative "701=I"
                           THEN  \ 2016sep18: end of test for default ego-concept "701=I"
                          -1 +LOOP   \ 2016sep18: loop backwards 
                        THEN  \ 2016sep18: end of test for a re-interpreted 701=I.
                        LEAVE   \ 2016sep18: recall and inhibit only one idea.
                      THEN  \ 2016sep18: end of test for positive verblock.
                  THEN   \ 2016sep18: end of test for non-negative activation.
                THEN  \ 2016sep18: end of test for dba=1 nominative "I"; 
              THEN  \ 2016sep18: end of test for 701=I default ego-concept.
            -1 +LOOP  \ 2016sep18: end of parameter-based search-loop.
            701 subjpsi !   \ 2016aug25: for use elsewhere; 
            701 topic !      \ 2016aug25: for question-asking modules; 
            1 nphrnum !   \ 2016aug25: for EnArticle and EnVerbPhrase; 
            7 nphrpos !     \ 2016aug25: prevent article "A" with "I"; 
            1 subjnum !    \ 2016aug25: for use elsewhere; 
            1 prsn !          \ 2016aug25: for use elsewhere; 
          THEN  \ 2016aug14: end of test for "I" to become subj. not obj.
        THEN  \ 2016aug14: end of test for low activation warranting default to ego.
      THEN  \ 2016aug14: end of test for no nounlock. 
    \ dirobj @  1 = IF    \ 2017-09-01: if thinking of a direct object...
    \   nphrpos @ 5 = IF  \ 2017-09-01: only nouns, not adjectives or pronouns.
    \     EnArticle  \ 2017-09-01: module for thinking an English article.
    \     EnArticle  \ 2018-06-19: wait for better rules about calling EnArticle.
    \   THEN  \ 2017-09-01: end of test for a 5=noun noun-phrase part-of-speech
    \ THEN  \ 2017-09-01: allow an article for a direct object. 
      nphrpos @ 5 = IF  \ 2018-09-07: only nouns, not adjectives or pronouns.
        0 anset !  \ 2018-09-07: prevent carry-over.
        aud @  0  ear{ @ 65 = IF 65 anset ! THEN  ( 2018-09-07: if vowel A )
        aud @  0  ear{ @ 69 = IF 69 anset ! THEN  ( 2018-09-07: if vowel E )
        aud @  0  ear{ @ 73 = IF 73 anset ! THEN  ( 2018-09-07: if vowel I )
        aud @  0  ear{ @ 79 = IF 79 anset ! THEN  ( 2018-09-07: if vowel O )
        aud @  0  ear{ @ 85 = IF 85 anset ! THEN  ( 2018-09-07: if vowel U )
        nphrnum @ 0 > IF  motjuste @ usx ! THEN  \ 2018-09-07: num(ber) required.
        EnArticle  \ 2018-09-07: module for thinking an English article.
      THEN  \ 2018-09-07: end of test for a 5=noun noun-phrase part-of-speech
      audjuste @ aud !  \ 2016aug14: recall-vector for SpeechAct
      Speech   \ 2018-10-07: EnNounPhrase calls the Speech module
      -32 tsels @ 3 psy{ !  \ 2017jun15: inhibit the subject just spoken.
      motjuste @ 701 = NOT IF  \ 2016aug25: if not 701=I; 
        motjuste @ 707 = NOT IF  \ 2016aug25: not 707=you; 
          motjuste @ 731 = NOT IF  \ 2016aug25: 731=WE; 
            3 prsn !  \ 2016aug25: not I YOU WE; 
          THEN  \ 2016aug25: end of test for 731=WE; 
        THEN  \ 2016aug25:  end of test for 707=YOU; 
      THEN  \ 2016aug25: end of test for "not I".
    ;  \ EnNounPhrase returns to EnVerbPhrase or Indicative
    


    5. Troubleshooting and Robotic Psychosurgery

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

    5.1.a. Symptom: In either a pre-existing AI or a new AI, the activation of multiple subject-nouns is detected by the etc flag as a trigger to let the ConJoin module insert a conjunction like "AND" between multiple ideas being expressed as output. Sometimes a problem of runaway activations may occur among the subject-nouns being considered by the noun-phrase module for selection as part of an idea to be output as a thought. In such a case the AI may be filled with a burgeoning swarm of activated subjects and may not be able to stop outputting needlessly compound sentences.

    5.1.b. Solution: The AI Mind Maintainer may troubleshoot the problem by inserting a diagnostic message into that part of the noun-phrase module where nouns are competing to be selected for having the highest activation. The temporary diagnostic message shall report the location in conceptual Psy memory of the activated noun as identified by the looping index-number; the concept-number that identifies the active noun; the number of activated candidates as tallied by the etc variable; and the level of runaway activation as revealed by the value riding on the act variable. The following sample Perl code shows a typical diagnostic message.

      print "\n EnNP i= $i k1= $k[1] etc= $etc act= $act \n";
    }  # 2016feb12: end of test for a higher activation $act
    
    If there are too many activated subject-nouns, the reported etc value will grow larger and larger as proof that there is a problem. One solution in the past has been to make sure that the InStantiate module modestly increases the activation on recognized concepts only from the outside world and not on concepts being thought and being stored in memory as part of the re-entry process. If re-entrant thoughts were to receive activation, then that process could be the source of runaway activation.


    6. Variables for First Working Artificial General Intelligence

    $act -- quasi-neuronal activation-level

    $aud -- in the Speech() module is an associative tag leading to the typically most recent engram of a word stored in the @ear array of the auditory memory channel.

    $audjuste -- EnNounPhrase() $motjuste $aud to Speech() module

    $catsubj -- flag for holding the concept-number of the SUBJect-noun of words conCATenated together into the first phrase of a potentially compound output sentence, so that one-by-one the words of a candidate second phrase may each be tested for a match with the counterpart word in the very first phrase, and thus, if a conjunction like "AND" from ConJoin is about to add the second phrase to the first phrase, the AI may omit the repetitious same subject from the second phrase, and also the verb if it is found to be repetitious in the EnVerbPhrase module, with the result that the AI syncopates or shortens the compound sentence into a single-subject and single-verb sentence such as, "JOHN HAS A HOUSE AND A CAR" instead of "JOHN HAS A HOUSE AND JOHN HAS A CAR".

    $defact -- default activation for EnNounPhrase()

    $dirobj -- flag indicates seeking for a direct object. Should perhaps be renamed "dirobjcon" so as to indicate a condition rather than a particular direct object.

    $etc -- number of simultaneously active ideas for ConJoin() to separate with a conjunction.

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

    $nphrpos -- "noun-phrase part-of-speech" for testing during the EnThink() process.

    $nounlock -- time-point for a verb to lock onto a seq-noun.

    $subjnum -- (subject number) for agreement in grammatical number between a subject and a predicate nominative noun.

    $subjpsi -- subject-concept parameter to govern person of verb-forms

    $tsels -- Time of SELection of Subject -- is used locally in EnNounPhrase() and in RuNounPhrase() to keep track of the experiential time $t at which a stored concept is selected as a subject, so that the $tsels can be used to revisit the engram at $tsels to change its activation-level in the course of neural inhibition.

    $verblock -- for subject-noun to lock onto seq-verb. The $verblock is a time-point in conceptual @psy memory where the $seq of a subject-noun is located, so that any crucial consideration such as the negation of a verb will be found when the verb-phrase module fetches the verb-concept from memory. If the thinking process finds and activates a particular subject-noun in memory, the $tkb of the subject noun becomes the $verblock so that a particular verb at a particular time will be selected by the English or Russian verb-phrase module.


    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
    http://en.wikipedia.org/wiki/Natural_language_understanding -- solved.
    http://old.reddit.com/r/ControlProblem -- NOT SOLVED.
    javascript subreddit for AI Mind discussion;
    Forth subreddit for MindForth discussion;
    Perl subreddit for ghost.pl AI Mind Maintainers.
    If you have any questions about the First Working AGI, please Join the Discussion.
    Joint Artificial Intelligence Center (JAIC) -- the AI Manhattan Project.