EnArticle English Article Module of the

English and Russian bilingual ghost.pl AI in Perl

Mens Latina in Latin -- MindForth for Robots


1. Diagram of the EnArticle English Article Mind-Module


   /^^^^^^^^^\             ________________        /^^^^^^^^^\
  /   EYE     \     | | | / EnThink module \      /   EAR     \
 /             \    | | | \________________/     / ___________ \
|               |   | | |  _____|____________   | / MindBoot  \ |
|   _______     |   | | | (  Indicative      )  || Russian     ||
|  /image  \    |   | | |  \________________/   || and English ||
| / percept \---|-----+ |       |         |     || bootstrap   ||
| \ engram  /   |  a| | |       |         V__   || "vault"     ||
|  \_______/    |  b|c| |       |        /En-\  | \___________/ |
|               |  s|o|f|       |       /Verb-\ |               |
|   visual      |  t|n|i|       |      ( Phrase)|  auditory     |
|               |  r|c|b|       |       \_____/ |  memory       |
|   memory      |  a|e|e|    ___V____________   |  channel      |
|               |  c|p|r|   /                \  |  __________   |
|   channel     |  t|t|s|  (   EnNounPhrase   ) | /  "a"     \  |
|               |   | | |   \________________/  | \  "big"   /  |
|               |   | | |  __|____   |          |  \ "dog " /   |
|               |   | | | /       \  |          |   \______/    |
|   _______     |   | | |(EnArticle) |          |  __________   |
|  /fresh  \    |   |_|_| \ "the" / _V_______   | /  "the"   \  |
| / image   \   |  /     \ \ "a" / /         \  | \  "big"   /  |
| \ engram  /---|--\ Psy /  \___/ (EnAdjective) |  \ "dog " /   |
|  \_______/    |   \___/          \_________/  |   \______/    |


2. Purpose of the EnArticle English Article Mind-Module

EnArticle has the purpose of selecting the definite article "the" or the indefinite article "a" to be used before an English noun in a thought being generated by the artificial inteligence.


3. Function of the EnArticle mind-module

The Article module was the first architectural add-on to the primitive, proof-of-concept AI Mind as described in the AI4U textbook of artificial intelligence. Prior to 2008, when the Article module was introduced, there were only enough modules in the AI Mind to demonstrate thinking, and the AI software did not function properly until the last major bugs were eliminated from MindForth in January of 2008.

The proof-of-concept AI Mind could think only in terms of plural nouns without the articles "a" or "the". It is difficult for a human user to talk only about plural nouns with the AI. The user feels a natural desire to discuss a single instance of an otherwise plural topic. Therefore the first step in expanding a primitive AI Mind is to add a group of features that include the use of singular forms for nouns and verbs, and the use of intransitive verbs of being and becoming for the discussion of both singular and plural topics.

The AI Mind must have a reason to select "a" or "the" or even to use any article at all. In AI software we must computationalize the mental phenomena that a biological brain-mind seems to achieve so effortlessly, but which are so difficult to achieve in a computer emulating the human brain. In the AI, we will use software flag variables to perform the function of associative tag neurons connecting one concept or brain-module to another in the human brain-mind.


4. Code of EnArticle() from ghost327.pl AI source code in Perl


sub EnArticle() {  # http://ai.neocities.org/EnArticle.html
  $usn = ($usn + 1);  # 2018-09-03: increment the upstream-idea rotation number.
# if ($usx > 0) { $us1 = $usx };  # 2018-09-03: transfer the noun concept value. 
  if ($usx > 0 && $usn==1) { $us1 = $usx };  # 2018-09-03: transfer the noun concept. 
  if ($usx > 0 && $usn==2) { $us2 = $usx };  # 2018-09-03: transfer the noun concept. 
  if ($usx > 0 && $usn==3) { $us3 = $usx };  # 2018-09-03: transfer the noun concept. 
  if ($usx > 0 && $usn==4) { $us4 = $usx };  # 2018-09-03: transfer the noun concept. 
  if ($usx > 0 && $usn==5) { $us5 = $usx };  # 2018-09-03: transfer the noun concept. 
  if ($usx > 0 && $usn==6) { $us6 = $usx };  # 2018-09-03: transfer the noun concept. 
  if ($usx > 0 && $usn==7) { $us7 = $usx };  # 2018-09-03: transfer the noun concept. 
  if ($usn > 6) { $usn = 1 };  # 2018-09-03: after $usn=7 rotate back to $usn=1
  if ($subjnum==1 && $qv2psi==800) { #2017-12-11: Deal with "I AM...."
    for (my $i=$t; $i>$midway; $i--) {  # 2017-12-11: search for 101=A
      my @k=split(',',$psy[$i]);  # 2017-12-11: examine @psy array;
      if ($anset==0) {  # 2017-12-12: if no vowel at start of noun...
        if ($k[1] == 101) {  # 2017-12-11: if 101=A is found;
          $audjuste = $k[20];  # 2019-08-01: "A" recall-vector;
          $aud = $k[20];  # 2019-08-01: "A" recall-vector for Speech()
          if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-12-11: End of search for 101=A;
      }  # 2017-12-12: end of test for vowel-flag $anset
      if ($anset>0) {  # 2017-12-12: if vowel at start of noun...
        if ($k[1] == 102) {  # 2017-12-12: if 102=AN is found;
          $audjuste = $k[20];  # 2019-08-01: "AN" recall-vector;
          $anset = 0;  # 2017-12-12: reset to zero for safety. 
          $aud = $k[20];  # 2019-08-01: "AN" recall-vector for Speech()
          if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-12-12: End of search for 102=AN;
      }  # 2017-12-12: end of test for positive vowel-flag $anset
    }  # 2017-12-11: End of search loop from $t back to $midway.
    Speech();  # 2017-12-11: speak the word starting at the $aud time. 
    return;  # 2018-09-03: if saying "A", skip saying "THE".
  }  # 2017-12-11: end of test for singular subject with 800=BE verb.
  if ($usx == $us1) {  # 2018-09-03: if "the" is warranted...
    for (my $i=$t; $i>$midway; $i--) {  # 2017-08-31: search for 117=THE
      my @k=split(',',$psy[$i]);  # 2017-08-31: examine @psy array;
      if ($k[1] == 117) {  # 2017-08-31: if 117=THE is found;
        $audjuste = $k[20];  # 2019-08-01: "THE" recall-vector;
        $aud = $k[20];  # 2019-08-01: "THE" recall-vector for Speech()
        if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-08-31: End of search for 117=THE;
    }  # 2017-08-31: End of search loop from $t back to $midway.
    Speech();  # 2017-08-31: speak the word starting at the $aud time. 
    return;  # 2018-09-03: say only one "THE".
  }  # 2018-09-03: end of test for need to say "THE".
  if ($usx == $us2) {  # 2018-09-03: if "the" is warranted...
    for (my $i=$t; $i>$midway; $i--) {  # 2017-08-31: search for 117=THE
      my @k=split(',',$psy[$i]);  # 2017-08-31: examine @psy array;
      if ($k[1] == 117) {  # 2017-08-31: if 117=THE is found;
        $audjuste = $k[20];  # 2018-09-01: "THE" recall-vector;
        $aud = $k[20];  # 2019-08-01: "THE" recall-vector for Speech()
        if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-08-31: End of search for 117=THE;
    }  # 2017-08-31: End of search loop from $t back to $midway.
    Speech();  # 2017-08-31: speak the word starting at the $aud time. 
    return;  # 2018-09-03: say only one "THE".
  }  # 2018-09-03: end of test for need to say "THE".
  if ($usx == $us3) {  # 2018-09-03: if "the" is warranted...
    for (my $i=$t; $i>$midway; $i--) {  # 2017-08-31: search for 117=THE
      my @k=split(',',$psy[$i]);  # 2017-08-31: examine @psy array;
      if ($k[1] == 117) {  # 2017-08-31: if 117=THE is found;
        $audjuste = $k[20];  # 2019-08-01: "THE" recall-vector;
        $aud = $k[20];  # 2019-08-01: "THE" recall-vector for Speech()
        if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-08-31: End of search for 117=THE;
    }  # 2017-08-31: End of search loop from $t back to $midway.
    Speech();  # 2017-08-31: speak the word starting at the $aud time. 
    return;  # 2018-09-03: say only one "THE".
  }  # 2018-09-03: end of test for need to say "THE".
  if ($usx == $us4) {  # 2018-09-03: if "the" is warranted...
    for (my $i=$t; $i>$midway; $i--) {  # 2017-08-31: search for 117=THE
      my @k=split(',',$psy[$i]);  # 2017-08-31: examine @psy array;
      if ($k[1] == 117) {  # 2017-08-31: if 117=THE is found;
        $audjuste = $k[20];  # 2019-08-01: "THE" recall-vector;
        $aud = $k[20];  # 2019-08-01: "THE" recall-vector for Speech()
        if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-08-31: End of search for 117=THE;
    }  # 2017-08-31: End of search loop from $t back to $midway.
    Speech();  # 2017-08-31: speak the word starting at the $aud time. 
    return;  # 2018-09-03: say only one "THE".
  }  # 2018-09-03: end of test for need to say "THE".
  if ($usx == $us5) {  # 2018-09-03: if "the" is warranted...
    for (my $i=$t; $i>$midway; $i--) {  # 2017-08-31: search for 117=THE
      my @k=split(',',$psy[$i]);  # 2017-08-31: examine @psy array;
      if ($k[1] == 117) {  # 2017-08-31: if 117=THE is found;
        $audjuste = $k[20];  # 2019-08-01: "THE" recall-vector;
        $aud = $k[20];  # 2019-08-01: "THE" recall-vector for Speech()
        if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-08-31: End of search for 117=THE;
    }  # 2017-08-31: End of search loop from $t back to $midway.
    Speech();  # 2017-08-31: speak the word starting at the $aud time. 
    return;  # 2018-09-03: say only one "THE".
  }  # 2018-09-03: end of test for need to say "THE".
  if ($usx == $us6) {  # 2018-09-03: if "the" is warranted...
    for (my $i=$t; $i>$midway; $i--) {  # 2017-08-31: search for 117=THE
      my @k=split(',',$psy[$i]);  # 2017-08-31: examine @psy array;
      if ($k[1] == 117) {  # 2017-08-31: if 117=THE is found;
        $audjuste = $k[20];  # 2019-08-01: "THE" recall-vector;
        $aud = $k[20];  # 2019-08-01: "THE" recall-vector for Speech()
        if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-08-31: End of search for 117=THE;
    }  # 2017-08-31: End of search loop from $t back to $midway.
    Speech();  # 2017-08-31: speak the word starting at the $aud time. 
    return;  # 2018-09-03: say only one "THE".
  }  # 2018-09-03: end of test for need to say "THE".
  if ($usx == $us7) {  # 2018-09-03: if "the" is warranted...
    for (my $i=$t; $i>$midway; $i--) {  # 2017-08-31: search for 117=THE
      my @k=split(',',$psy[$i]);  # 2017-08-31: examine @psy array;
      if ($k[1] == 117) {  # 2017-08-31: if 117=THE is found;
        $audjuste = $k[20];  # 2019-08-01: "THE" recall-vector;
        $aud = $k[20];  # 2019-08-01: "THE" recall-vector for Speech()
        if ($k[20]>0) { $aud=$k[20]; last }  # 2019-08-01: insurance
        }  # 2017-08-31: End of search for 117=THE;
    }  # 2017-08-31: End of search loop from $t back to $midway.
    Speech();  # 2017-08-31: speak the word starting at the $aud time. 
    return;  # 2018-09-03: say only one "THE".
  }  # 2018-09-03: end of test for need to say "THE".
  $anset = 0; # 2017-12-12: reset in any case, such as conjoined ideas.
}  # 2019-08-01: EnArticle() returns to EnNounPhrase() module.


5. Variables for the EnArticle (English article) mind-module

$anset -- sets "an" before a vowel at the start of a noun.

$subjnum -- (subject number) -- to keep indefinite article "a" from being used with plural nouns.

$us1 -- the upstream noun number one for EnArticle to keep track of.

$usn -- an upstream number-variable to coordinate the rotation of the us1-us7 variables in their role as the holders of noun-concepts mentioned so recently that they warrant the insertion of the definite article "the" by the Enarticle() module.

$usx -- a transfer variable for InStantiate to transfer the concept number of an incoming noun to whichever us1-us7 upstream variable is up next in the rotation of up to seven recently mentioned noun-concepts, so that the EnArticle module may insert the definite article "the" before any noun currently under discussion in a conversation or an internal thought.


6. Troubleshooting of EnArticle Module with NLU

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

It is easier to debug the EnArticle module in Forth or in Perl than in JavaScript, because the MindForth source code is not so high level as the JSAI (JavaScript Artificial Intelligence). MindForth also has more diagnostic routines that show the AI mind maintainer what is happening deep inside the AI software when anything goes wrong. Forth is also more forgiving of mistakes than JavaScript is. MindForth will usually run and display problem behavior if a programmer makes a mistake, whereas a JavaScript program oftentimes will not run at all with a mistake in its code.

Whether in Forth, JavaScript or Perl, the EnArticle module leaves traces of its behavior visible in the Diagnostic display mode. A programmer can examine the psi concept flags to make sure that the proper associations are forming among concepts, and to see what residual activations are left on concepts after the EnArticle module has performed its work.


7. Future Development of EnArticle Module with NLU


Changes To Be Made:

Some new variables for keeping track of the definite article "the" will make it radically simpler for EnArticle to select "a" or "the" as an article before a noun.

$us1 -- the UpStream noun number one for EnArticle to keep track of;

$us2 -- the UpStream noun number two for EnArticle to keep track of;

$us3 -- the UpStream noun number three for EnArticle to keep track of;

$us4 -- the UpStream noun number four for EnArticle to keep track of;

$us5 -- the UpStream noun number five for EnArticle to keep track of;

$us6 -- the UpStream noun number six for EnArticle to keep track of;

$us7 -- the UpStream noun number seven for EnArticle to keep track of.

These "upstream" variables will perform their duty on a rotating basis. That is, we Mind Maintainers will let the AI Mind mentally keep track of up to seven nouns which deserve to be designated with the article "the" because the noun is under current discussion. It will not matter what the ordinal number of each "us" variable is. It will only matter that if the "us" variable contains the Psy concept-number of a noun currently under discussion, and then the AI Mind may use "the" to refer to "the concept" or "the thing" or "the item."

When the "upstream" system is in place, the EnArticle module will become easier for AI programmers to code. By default, if the article "the" is not being used, it is a safe bet to use the indefinite article "a" with a single noun. For instance, if the AI is not saying "I see the dog," it makes sense to say "I see a dog." Once a dog-centered discussion starts, it becomes "the dog".


Special Notes:
It may be possible for the AI to recognize incoming "AN" with a correct $Audpsi but without a $psi number in the MindBoot, so that the AI will not be able to generate an incorrect phrase like "I HAVE AN BOOK". Likewise it may be possible to recognize "AN" but not have the $psi number be stored.

There are other, substandard words which are variants on a standard word, and it may be possible to make such words be recognizable but not recallable.


8. Resources for EnArticle Module with NLU

  • Artificial Intelligence in Ancient Latin

  • http://github.com/kernc/mindforth/blob/master/wiki/EnArticle.wiki

  • http://github.com/PriorArt/AGI/wiki/MindGrid


    9. AiTree of Mind-Modules for Natural Language Understanding

    See AI 101 AI 102 AI 103 year-long community college AI course curriculum.


    Paperback book on AI in ancient Latin

    Artificial Intelligence in Ancient Latin -- is available from Amazon in various countries:
    Australia - Canada - France - Germany - Italy - Japan - Netherlands - Singapore - Spain - United Kingdom - United States.
    https://redditfavorites.com/products/artificial-intelligence-in-ancient-latin
    Ada's Technical Books
    425 15th Avenue East
    Seattle, WA 98122
    USA Tel. 206-322-1058


    Website Counter


    >