OutBuffer module of the

English and Russian bilingual ghost.pl AI in Perl

Mens Latina in Latin -- MindForth for Robots


1. Diagram of the OutBuffer Mind-Module


  /^^^^^^^^^^^\OutBuffer has right-justified words/^^^^^^^^^^^\
 /   EYE       \            _________________    /    EAR      \
|               |CONCEPTS  /    Volition     \  |  ___________  |
|   _______     |   | | |  \_________________/  | / MindBoot  \ |
|  / old   \    |   | | |   _|___      _|____   || memory vault||
| / image   \!!!|!!!|!|!|  /     \    /      \  ||             ||
| \ recog   /---|---|-|-+ (EnThink)  (RuThink ) || "students"  ||
|  \_______/    |   |s| |  \_____/    \______/  || "read"      ||
|               |   |t| |          _____|______ || "books"     ||
|               |   |u| | _____   (RuIndicative)| \___________/ |
|               |   |d|b|| Ru- \   \__________/ |               |
|   visual      |  r|e|o|| Noun-\  / ___|____   |               |
|               |  e|n|o|| Phrase\/ / RuVerb-\  |  Я            |
|   memory      |  a|t|k||_______/ /  Phrase  \ |  ЧИТАЮ        |
|               |  d|s|s|          \__________/ |  КНИГИ        |
|   channel     |   | | |   _________|_____     |               |
|               |   | | |  /   RuVerbGen   \    |  ТЫ           |
|               |   | | | (     ЧИТАЕШЬ     )   |  ЧИТАЕШЬ      |
|   _______     |   | | |  \_______________/    |  КНИГИ        |
|  /new    \    |   | | | ___|_____   ___|_____ |               |
| / percept \   |   |_|_||AudBuffer| |OutBuffer||               |
| \ engram  /---|---(Psy)|ЧИТАЮ    | |    ЧИТАЮ||               |
|  \_______/    |    \_/ |_________| |_________||               |


2. Purpose of the OutBuffer Module

The OutBuffer module serves the purpose of right-justifying a word in English or Russian or any other natural language so that the AI Mind may change any initial inflected ending into any desired inflectional ending. In order to identify any pre-existing inflection and to determine the stem of a word, a module like EnVerbGen or RuVerbGen needs to test for the contents of the last few buffer-variables in a right-justified word.


3. Function of the OutBuffer Module

The OutBuffer module first erases all data stored in it as the values of the buffer variables. Then OutBuffer converts all the left-justified characters in the AudBuffer into right-justified characters in the OutBuffer, so that a module like EnVerbGen (for thinking in English) or RuVerbGen (for thinking in Russian) may manipulate the right-justified endings, or inflections, stored in the OutBuffer.

As of the ghost301.pl AI in Perl and the RuAi012A Russian AI Dushka in JavaScript, the buffer characters in OutBuffer count backwards from the final character in a word, so that, for instance, a three-character inflectional ending may be identified and manipulated as $b3 + $b2 + $b1. With this arrangement, it does not matter how many b-for-buffer characters there are in total. An English or Russian AI may have sixteen buffer-characters in the OutBuffer module, while a German AI might have twenty-four buffer-characters in order to accommodate the long compound words which occur frequently in German. A German ending like -ungen would then be identified as $b5 + $b4 + $b3 + $b2 + $b1.


4. Code of OutBuffer() from ghost301.pl First Working AGI in Perl


sub OutBuffer() {  # http://ai.neocities.org/OutBuffer.html
# $b1=""; $b2=""; $b3=""; $b4=""; $b5=""; $b6="";  # 2019-06-10
          $b2=""; $b3=""; $b4=""; $b5=""; $b6="";  # 2019-06-10
  $b7=""; $b8=""; $b9=""; $b10=""; $b11=""; $b12="";  # 2019-06-10
  $b13=""; $b14=""; $b15=""; $b16="";  # 2016apr02: clear tabula rasa;
  if ($c16 ne "") {  # 2019-06-10: if the AudBuffer is full; 
# $b1=$c16; $b2=$c15; $b3=$c14; $b4=$c13;  # 2019-06-10
            $b2=$c15; $b3=$c14; $b4=$c13;  # 2019-06-10
  $b5=$c12; $b6=$c11; $b7=$c10; $b8=$c9;  # 2019-06-10
  $b9=$c8; $b10=$c7; $b11=$c6; $b12=$c5;  # 2019-06-10
  $b13=$c4; $b14=$c3; $b15=$c2; $b16=$c1;  # 2019-06-10
  return;    # 2019-06-10: abandon remainder of function; 
  }  # 2019-06-10: end of transfer of a 16-character word;
  if ($c15 ne "") {  # 2019-06-10: if the word is only 15 characters
    $b1=$c15; $b2=$c14; $b3=$c13; $b4=$c12; $b5=$c11; $b6=$c10;
    $b7=$c9; $b8=$c8; $b9=$c7; $b10=$c6; $b11=$c5; $b12=$c4; 
    $b13=$c3; $b14=$c2; $b15=$c1; $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function;
  }  # 2016apr02:  end of transfer of a 15-character word;
  if ($c14 ne "") {  # 2016apr03: if the word is only 14 characters
    $b1=$c14; $b2=$c13; $b3=$c12; $b4=$c11; $b5=$c10; $b6=$c9;
    $b7=$c8; $b8=$c7; $b9=$c6; $b10=$c5; $b11=$c4; $b12=$c3;
    $b13=$c2; $b14=$c1; $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function;
  }  # 2019-06-10: end of transfer of a 14-character word;
  if ($c13 ne "") {  # 2019-06-10: if the word is only 13 characters
    $b1=$c13; $b2=$c12; $b2=$c11; $b4=$c10; $b5=$c9; $b6=$c8;
    $b7=$c7; $b8=$c6; $b9=$c5; $b10=$c4; $b11=$c3; $b15=$c2;
    $b12=$c1; $b14="";  $b15="";  $b16="";  # 2019-06-01
    return;  # 2019-06-10: abandon remainder of function;
  }  # 2019-06-10: end of transfer of a 13-character word;
  if ($c12 ne "") {  # 2019-06-10: if the word is only 12 characters
    $b1=$c12; $b2=$c11; $b3=$c10; $b4=$c9; $b5=$c8; $b6=$c7;
    $b7=$c6; $b8=$c5; $b9=$c4; $b10=$c3; $b11=$c2; $b12=$c1;
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10:  abandon remainder of function; 
  }  # 2019-06-10:  end of transfer of a 12-character word;
  if ($c11 ne "") {  # 2019-06-10: if the word is only 11 characters
    $b1=$c11; $b2=$c10; $b3=$c9; $b4=$c8; $b5=$c7; $b6=$c6;
    $b7=$c5; $b8=$c4; $b9=$c3; $b10=$c2; $b11=$c1; $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function;
  }  # 2019-06-10: end of transfer of an 11-character word;
  if ($c10 ne "") {  # 2019-06-10: if the word is only 10 characters
    $b1=$c10; $b2=$c9; $b3=$c8; $b4=$c7; $b5=$c6; $b6=$c5;
    $b7=$c4; $b8=$c3; $b9=$c2; $b10=$c1; $b11=""; $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function;
  }  # 2019-06-10: end of transfer of a 10-character word;
  if ($c9 ne "") {  # 2019-06-10: if the word is only 9 characters
    $b1=$c9; $b2=$c8; $b3=$c7; $b4=$c6; $b5=$c5; $b6=$c4;
    $b7=$c3; $b8=$c2; $b9=$c1; $b10="";  $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function;
  }  # 2019-06-10: end of transfer of a 9-character word; 
  if ($c8 ne "") {  # 2019-06-10: if the word is only 8 characters
    $b1=$c8; $b2=$c7; $b3=$c6; $b4=$c5; $b5=$c4; $b6=$c3;
    $b7=$c2; $b8=$c1; $b9="";  $b10="";  $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10:  abandon remainder of function;
  }  # 2019-06-10: end of transfer of an 8-character word;
  if ($c7 ne "") {  # 2019-06-10: if the word is only 7 characters
    $b1=$c7; $b2=$c6; $b3=$c5; $b4=$c4; $b5=$c3; $b6=$c2;
    $b7=$c1; $b8="";  $b9="";  $b10="";  $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function;
  }  # 2019-06-10: end of transfer of a 7-character word; 
  if ($c6 ne "") {  # 2019-06-10: if the word is only 6 characters
    $b1=$c6; $b2=$c5; $b3=$c4; $b4=$c3; $b5=$c2; $b6=$c1;
    $b7="";  $b8="";  $b9="";  $b10="";  $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function; 
  }  # 2019-06-10: end of transfer of a 6-character word; 
  if ($c5 ne "") {  # 2019-06-10: if the word is only 5 characters
    $b1=$c5; $b2=$c4; $b3=$c3; $b4=$c2; $b5=$c1; $b6="";
    $b7="";  $b8="";  $b9="";  $b10="";  $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function; 
  }  # 2016apr02: end of transfer of a 5-character word; 
  if ($c4 ne "") {  # 2019-06-10: if the word is only 4 characters
    $b1=$c4; $b2=$c3; $b3=$c2; $b4=$c1; $b5="";  $b6="";
    $b7="";  $b8="";  $b9="";  $b10="";  $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function; 
  }  # 2019-06-10: end of transfer of a 4-character word; 
  if ($c3 ne "") {  # 2019-06-10: if the word is only 3 characters
    $b1=$c3; $b2=$c2; $b3=$c1; $b4=""; $b5="";  $b6="";
    $b7="";  $b8="";  $b9="";  $b10="";  $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function; 
  }  # 2019-06-10: end of transfer of a 3-character word; 
  if ($c2 ne "") {  # 2019-06-10: if the word is only 2 characters
    $b1=$c2; $b2=$c1; $b3="";  $b4=""; $b5="";  $b6="";
    $b7="";  $b8="";  $b9="";  $b10="";  $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function; 
  }  # 2019-06-10: end of transfer of a 2-character word;
  if ($c1 ne "") {  # 2019-06-10: if the word is only 1 character
    $b1=$c1; $b2=""; $b3="";  $b4=""; $b5="";  $b6="";
#            $b2=""; $b3="";  $b4=""; $b5="";  $b6="";
    $b7="";  $b8="";  $b9="";  $b10=""; $b11="";  $b12="";
    $b13="";  $b14="";  $b15="";  $b16="";  # 2019-06-10
    return;  # 2019-06-10: abandon remainder of function; 
  }  # 2019-06-10: end of transfer of a 1-character word; 
}  # 2019-06-10: OutBuffer() returns to AudBuffer or VerbGen()


5. Variables for First Working Artificial General Intelligence

$b1 -- buffer variable 1 in the OutBuffer() quasi-array for the right-justifying of an English or Russian word of up to sixteen characters in length. The buffer variable $b1 always contains the very last character in a word of any length. Since each word is right-justified in the OutBuffer(), a module like NounGen() or RuVerbGen() can perform tests on the contents of $b3 and $b2 and $b1 so as to detect one inflectional ending and to replace it with a different ending as necessary. In English, where a noun like "beach" or a verb like "teach" will sometimes need to have "-es" as an ending ("beaches", "teaches"), $b2 and $b1 can be used to detect the "-ch" at the end of the word, as an indicator that the "-es" ending may need to be added on.

$b2 -- buffer variable 2 counting backwards from the final OutBuffer character.

$b3 -- buffer variable 3 counting backwards from the final OutBuffer character.

$c1 -- the leftmost first character of any word stored in AudBuffer().

$c2 -- the second character of any word stored in AudBuffer().


6. Troubleshooting and Robotic Psychosurgery

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


7. Future Development

Roadmap to Artificial Intelligence

An AI Mind Maintainer may increase the size of the AudBuffer or the OutBuffer, especially for any natural language containing a vocabulary of especially long words, such as German words like Fliegerabwehrkanone -- which in English becomes flak.


8. Resources


Please see

http://github.com/kernc/mindforth/blob/master/wiki/OutBuffer.wiki


9. AiTree of First Working AGI Mind-Modules

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


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.
Ada's Technical Books
425 15th Avenue East
Seattle, WA 98122
USA Tel. 206-322-1058


Website Counter