AudInput Auditory Input Module of the

English and Russian bilingual ghost.pl AI in Perl

Mens Latina in Latin -- MindForth for robots

1. Diagram of the AudInput (Auditory Input) Mind-Module

The AudInput module receives input for the sense of hearing.

   /^^^^^^^^^\ Word-Audition Brings Images To Mind /^^^^^^^^^\
  /   EYE     \                       _______     /   EAR     \
 /             \ CONCEPTS            / New-  \   /             \
|   _______     |  | | |   _______  ( Concept )-|-------------\ |
|  /old    \!!!!|!!|!| |  / Old-  \  \_______/  |  Audition   | |
| / engram  \---|----+ | ( Concept )-----|------|----------\  | |
| \ fetch   /   |  | | |  \_______/------|------|-------\  |  | |
|  \_______/    |  | | |     |    \      |      |  c    |  |  | |
|               | a| | |     |     \     |      |   a   |  |  | |
|  visual       | b|C| |     |      \    |      |    t  |  |  | |
|               | s|O|f|     |       \  _V__    |     s-/  |  | |
|  memory       | t|N|i|     |        \/    \   |          |  | |
|               | r|C|b|     |        /      \  |  e       |  | |
|  reactivation | a|E|e|   __V____   ( Parser ) |   a      |  | |
|               | c|P|r|  /       \   \      /  |    t-----/  | |
|  channel      | t|T|s| /SpreadAct\   \____/   |             | |
|   _________   |  |_|_| \_________/     |      |  f          | |
|  /composite\  | / Psy \/       ________V__    |   i         | |
| / remembered\ |( Mind- )      /           \   |    s        | |
| \ images    /-|-\Core /------( InStantiate )  |     h-------/ |
|  \_________/  |  \___/        \___________/   |               |


2. Purpose of the AudInput auditory input module

The AudInput module is designed to simulate the acoustic input of human speech by treating keyboard characters as phonemes of speech.


3. Algorithm of the AudInput mind-module

3.A. Calling AudListen

AudInput receives input from the human user via the keyboard by calling the AudListen module to listen for auditory input which is passed into the AudInput module.

3.B. Calling AudMem to store auditory input

AudInput calls the AudMem auditory memory module which both stores a word in the auditory memory array and calls the AudRecog module to recognize words or parts of words.

3.C. Differentiating between known concepts and new concepts.

If an incoming word is recognized, AudInput calls the OldConcept module to treat the word as an already known, old concept pre-existing in the @psy conceptual array. Otherwise, if an input word is not recognized, AudInput calls the NewConcept module to create a new concept expressed by the word.

3.D. Reentering words used as output by the AI Mind back into the AI Mind.

If all thoughts are sent to the Speech module, then that same output is reentered back into the mind through the AudInput module. If the Volition module permits the AI to think some thoughts silently without revealing its thought to circumambient humans, then those silent thoughts must bypass the Speech output module and reenter the AudInput module.

3.E. Responding to special keystrokes from the keyboard.

AudInput must respond to special keystrokes carrying special instructions:

3.F. Adjusting the speed of thought in compensation for varying circumstances

The AudInput module may slow down the internal speed of thought when human input begins so as to accommodate the relative slowness of human beings. If no human input is detected for a prolonged period of time, the AI Mind may be coded to think faster and faster until an ultimate speed of thought is attained. Sudden input by a human being may then abruptly slow down the internal thought processes of the artificial intelligence.

3.G. Acceptance of Roman characters for English and Cyrillic for Russian.

In the ghost.pl AI using Unicode for multiple languages, the AudInput module must not only accept each different alphabet but also detect any change in alphabet and reset a human-language identifier accordingly. A simple identifier like hlc may lock the thinking mechanisms into a specific language (e.g., English or Russian) until a different alphabet is encountered, or a more sophisticated identifier like rugov may permit a foreign word to be used within one language without shifting the thought-processes into another language.


4. Code of AudInput() from ghost294.pl First Working AGI in Perl


sub AudInput() {  # http://ai.neocities.org/AudInput.html
  $audpsi = 0;  # 2017-03-15: From MindForth -- prevent carry-over. 
  $iob = 0;  # 2017-09-13: reset indirect-object identifier for safety. 
  $spt = $t;      # 2016jan28: as in FileInput() module.
  $tio = 0; # 2017-09-13: reset at level above EnParser() and InStantiate()
  $tsn = $t;      # 2016mar13: current input is time-of-seqneed $tsn
  $_ = " ";       # 2016FEB03: PERL by Example (2015), p. 301 
  if ($pov == 2 && $hlc == 3) {  # 2018-09-27: prevent user-prompt during thinking
    if ($fyi == 1) { print "\nNow in user input Normal Mode." } # 2017-04-12
    if ($fyi == 2) { print "\nNow in user input Transcript Mode." } # 2017-04-12
    if ($fyi == 3) { print "\nNow in user input Tutorial Mode." } # 2017-04-12
    if ($fyi == 4) { print "\nNow in user input Diagnostic Mode." } # 2017-04-12
    print "\nTab cycles mode; Esc(ape) quits AI born $dob"; #2017-12-16
    print "\nEnter English or Russian words as Subject-Verb-Object: \n \n"; #2017-12-16
  }  # 2017-03-31: end of pov-check for displaying user-prompt.
  for ($hear = 0; $hear < 141; $hear++ )  {  # 2017-03-23: start input wait-loop
    if ($pov == 2) { # 2017-03-30: during external input 
      AudListen();  # 2017-03-24: check for keyboard input....
      if ($pho eq chr(27)) { print "The $vrsn.pl AI now ceases to live and think. \n"; } #09-11
      if ((ord $pho) == 27) { die "TERMINATE AI alive since $dob. \n"; } # 2019-01-25
      if ($pho eq "\xA0"||$pho eq "\x80") {$pho="\x80"; $hlc=3} # А
      if ($pho eq "\xA1"||$pho eq "\x81") {$pho="\x81"; $hlc=3} # Б
      if ($pho eq "\xA2"||$pho eq "\x82") {$pho="\x82"; $hlc=3} # В
      if ($pho eq "\xA3"||$pho eq "\x83") {$pho="\x83"; $hlc=3} # Г
      if ($pho eq "\xA4"||$pho eq "\x84") {$pho="\x84"; $hlc=3} # Д
      if ($pho eq "\xA5"||$pho eq "\x85") {$pho="\x85"; $hlc=3} # Е
      if ($pho eq "\xF1"||$pho eq "\xF0") {$pho="\xF0"; $hlc=3} # Ё
      if ($pho eq "\xA6"||$pho eq "\x86") {$pho="\x86"; $hlc=3} # Ж
      if ($pho eq "\xA7"||$pho eq "\x87") {$pho="\x87"; $hlc=3} # З
      if ($pho eq "\xA8"||$pho eq "\x88") {$pho="\x88"; $hlc=3} # И
      if ($pho eq "\xA9"||$pho eq "\x89") {$pho="\x89"; $hlc=3} # Й
      if ($pho eq "\xAA"||$pho eq "\x8A") {$pho="\x8A"; $hlc=3} # К
      if ($pho eq "\xAB"||$pho eq "\x8B") {$pho="\x8B"; $hlc=3} # Л
      if ($pho eq "\xAC"||$pho eq "\x8C") {$pho="\x8C"; $hlc=3} # М
      if ($pho eq "\xAD"||$pho eq "\x8D") {$pho="\x8D"; $hlc=3} # Н
      if ($pho eq "\xAE"||$pho eq "\x8E") {$pho="\x8E"; $hlc=3} # О
      if ($pho eq "\xAF"||$pho eq "\x8F") {$pho="\x8F"; $hlc=3} # П
      if ($pho eq "\xE0"||$pho eq "\x90") {$pho="\x90"; $hlc=3} # Р
      if ($pho eq "\xE1"||$pho eq "\x91") {$pho="\x91"; $hlc=3} # С
      if ($pho eq "\xE2"||$pho eq "\x92") {$pho="\x92"; $hlc=3} # Т
      if ($pho eq "\xE3"||$pho eq "\x93") {$pho="\x93"; $hlc=3} # У
      if ($pho eq "\xE4"||$pho eq "\x94") {$pho="\x94"; $hlc=3} # Ф
      if ($pho eq "\xE5"||$pho eq "\x95") {$pho="\x95"; $hlc=3} # Х
      if ($pho eq "\xE6"||$pho eq "\x96") {$pho="\x96"; $hlc=3} # Ц
      if ($pho eq "\xE7"||$pho eq "\x97") {$pho="\x97"; $hlc=3} # Ч
      if ($pho eq "\xE8"||$pho eq "\x98") {$pho="\x98"; $hlc=3} # Ш
      if ($pho eq "\xE9"||$pho eq "\x99") {$pho="\x99"; $hlc=3} # Щ
      if ($pho eq "\xEA"||$pho eq "\x9A") {$pho="\x9A"; $hlc=3} # Ъ
      if ($pho eq "\xEB"||$pho eq "\x9B") {$pho="\x9B"; $hlc=3} # Ы
      if ($pho eq "\xEC"||$pho eq "\x9C") {$pho="\x9C"; $hlc=3} # Ь
      if ($pho eq "\xED"||$pho eq "\x9D") {$pho="\x9D"; $hlc=3} # Э
      if ($pho eq "\xEE"||$pho eq "\x9E") {$pho="\x9E"; $hlc=3} # Ю
      if ($pho eq "\xEF"||$pho eq "\x9F") {$pho="\x9F"; $hlc=3} # Я  
      if ($pho =~ /[a-z]/ || $pho =~ /[A-Z]/) { $hlc=1 }    # 2018-09-27: switch 
      $text = $text.$pho;  # 2017-11-27: concatenation, Perl Black Book p. 149
      print ($text); # 2017-11-27: show accumulation of concatenated input.
        if ($pho eq chr(9)) {  # 2017-04-12: if user presses Tab-key...
        $fyi = ($fyi + 1);  # 2017-04-12: change to next user-input-mode
        if ($fyi > 4) {$fyi = 1}  # 2017-04-12: cycle back to Normal Mode.
      }  # 2017-04-12: end of test for press of Tab-key to change modes.
      if ($pho eq chr(9)) {  # 2019-01-25: if user presses ASCII-9 TAB key...
        print "\n TAB changes display mode to $fyi"; # 2019-01-25: situation-report
        if ($fyi==0) { print " = bare-bones \n"; }   # 2019-01-25: without prompt.
        if ($fyi==1) { print " = Normal. \n"; }      # 2019-01-25: input/output.
        if ($fyi==2) { print " = Transcript. \n"; }  # 2019-01-25: future
        if ($fyi==3) { print " = Tutorial. \n"; }    # 2019-01-25: with arrays.
        if ($fyi==4) { print " = Diagnostic. \n"; }  # 2019-01-25: with arrays.
      }  # 2019-01-25: expanded snippet informs user of change of display-mode.
      if ($pho eq chr(27)) { print "Ghost AI now ceases to live and think. \n"; } 
      if ($pho eq chr(27)) { die "TERMINATE: ESCape key for quit. \n"; } # 2017-03-27
      if ((ord $pho) == 0) {  # 2017-03-30: if no user input comes in...
        $impetus++; # 2017-12-03: if no input, increment $impetus for Volition()
        $isolation++;  # 2018-10-08: if no input, increment trigger for Imperative()
        $gapcon--;  # 2017-04-10: decrement gapcon for each loop with no input.
        if ($gapcon < 1)  {  # 2017-04-10: after an arbitrary pause for input...
          $pho = "\n";  # 2017-03-30: supply CR not entered by human user.
          $gapcon = 12; # 2017-04-12: reset gapcon as chosen by Mind-maintainer
          $len = 0;    # 2017-03-30: Reset so next word must accumulate length.
          $hear = 0;  # 20178-03-30: reset the main AudInput() loop.
          last;  # 2017-03-30: [Forth: LEAVE] exit from AudInput pause-loop.
        }  # 2017-03-30: end of test of size of no-input gap.
      }  # 2017-03-30: end of test for input to advise users to wait patiently.
      if ((ord $pho) > 0) { # 2017-12-21: if a character has come in...
        $t++;  # 2017-12-21: increment internal AI time "t" for AudMem()
      }  # 2017-12-21: end of test for a key-input.
      if ((ord $pho) > 32) { # 2017-12-21: if alphabetic letter has come in...
        $len++;  # 2017-12-21: increment word-length for AudRecog()
      }  # 2017-12-21: end of test for a letter of the alphabet
      if ($pho eq chr(83)) {  # 2017-04-30: if uppercase "S"...
        $num = 2;  # 2017-04-30: tentative assignment of plural num(ber)
      }  # 2017-04-30: end of test for 83=S
      if ($pho ne chr(32)) {  # 2017-04-30: if not 32=SPACE
        if ($pho ne chr(83)) {  # 2017-04-30: if not uppercase "S"...
          $num = 1;  # 2017-04-30: tentative assignment of singular num(ber)
        }  # 2017-04-30: 
      }  # 2017-04-30: end of space-test needed because of any $tult before SPACE. 
      if ((ord $pho) < 33) {  # 2017-04-30: if not an alphabetical character
        if ($endpho eq chr(83)) { $num = 2 }  # 2017-04-30: if final 83=S
      }  # 2017-12-16: for $num
      if ((ord $pho) > 31 || (ord $pho) == 13) {  # 2017-12-21: CR, SPACE, alphabetic letter
        if ($len == 1 && (ord $pho) != 32) {  # 2017-12-21: set only at start of a word
          if ($rv == 0 && (ord $pho) != 32) {  # 2017-12-21: no $rv for 32=SPACE
            $rv = $t;  # 2017-12-21: set recall-vector.
          }  # 2017-12-21: end of test for not-yet-set value; 2017-09-22: use len(gth)
        }  # 2017-12-21: end of more complex setting of value.
        if ($len == 0) { $audrec = 0 }  # 2017-12-21: prevent carry-over.
      if ($len > 0) {  # 2017-12-21: if incoming word already in progress.
        $endpho = $pho;  # 2017-12-21: keep track of previous character, for $num
        if ((ord $pho) == 32 || (ord $pho) == 13) { $len++ }  # SPACE increments length
      }  # 2017-12-21: end of test for at least a one-character word
      AudMem();  # 2018-09-27: for English or Russian input.
    }  # 2017-12-21: end of conditional test for entering or reentering character.
    if ((ord $pho) == 13) {  # 2017-12-21: CR-13 carriage-return
      $pho = chr 32;  # 2017-12-21: use SPACE for the recognition of a word. 
      $audrun = 1;  # 2017-12-21: Reset to one at CR end of input
      $eot = 13;  # 2017-12-21: end of transmission (EOT)
      print chr 10;  # 2017-12-21: ASCII linefeed LF-10
    }  # 2017-12-21: end of test for Enter-key carriage-return.
    if ((ord $pho) == 32 || (ord $pho) == 13) {  # 2017-12-21: after SPACE or CR...
      $audpsi = $finpsi;  # 2017-12-21: TEST -- retain final psi before 13-CR
      $pho = chr 32;  # 2017-12-21: use SPACE for the recognition of a word. 
      $audrun = 1;  # 2017-12-21: Reset to unity at end of a word.
      $spt = $t;   # 2017-12-21: set time-of-SPACE "spt" to current time "t".
      $tult = $t - 1;  # 2017-12-21: for storage at prior-by-one time-point.
      if ($audrec > 0) { $audpsi = $audrec }  # 2017-12-21
      if ($audpsi > 0) {  # 2017-12-21: if a word has been recognized...
        $impetus = 0;  # 2017-12-21: reset flag of counting no-input cycles.
        $isolation = 0;  # 2018-10-08: reset flag of counting no-input cycles.
        $sublen = 0;  # 2017-12-21: length of AudRecog subpsi word-stem
        $oldpsi = $audpsi;  # 2017-12-21: transfer value for OldConcept().
        $audpsi = 0;  # 2017-12-21: re-set to prevent carry-over. 
        $prc = 0;  # 2017-03-30: reset provisional recognition "prc";
        OldConcept();  # 2017-12-21: call module for recognized concepts. 
      } else {  # 2017-12-21: if no old concept is recognized...
        if ($len > 0) {  # 2017-12-21: if dealing with a word of positive length...
          $impetus = 0;  # 2017-12-21: reset flag of counting no-input cycles.
          $isolation = 0;  # 2018-10-08: reset flag of counting no-input cycles.
          my @aud=split(',',$ear[($t)]);  # 2017-12-21: break apart @aud row
          $ear[$t] = " ,$aud[1],$aud[2]"; # 2017-12-21: store 32=SPACE
          NewConcept();  # 2017-12-21: create new concept with number "nxt".
             @aud=split(',',$ear[($t)-1]);  # 2017-12-21: avoid "my" twice
          $ear[$t-1] = "$aud[0],$aud[1],$nxt"; # 2017-12-21: As in MindForth AI
          $nxt++;   # 2017-12-21:
        }  # 2017-12-21: end of test for a positive word-length.
      }  # 2017-12-21: end of test for a recognized audpsi concept. 
      AudDamp();  # 2017-12-21: de-activate auditory memory in advance of next word.
    } # 2017-12-21: end of test for 32=SP or 13=CR to make sure word has ended  
  } # 2017-12-21: new end of test for pov=2
  if (ord $doa == 13) { # 2017-12-21: if a 13=CR has been entered...
    $doa = 0;  # 2017-12-21: reset to prevent carry-over.
    last;  # 2017-12-21: exit from loop
  }  # 2017-12-21: end of test for CR=13
  if ($pov == 1) {  # 2016-12-16: for reentrant engrams without a hear-loop.
    if ((ord $pho) > 0) {  # 2017-03-30: if a character has come in...
      $t++;  # 2017-12-18: increment internal AI time "t" for AudMem()
    }  # 2017-03-30: end of test for a key-input.
    if ((ord $pho) > 32) {  # 2017-04-01: if alphabetic letter has come in...
      $len++;  # 2017-12-18: increment word-length for AudRecog()
    }  # 2017-04-01: end of test for a letter of the alphabet
    if ($pho eq chr(83)) {  # 2017-04-30: if uppercase "S"...
      $num = 2;  # 2017-04-30: tentative assignment of plural num(ber)
    } # 2017-04-30: end of test for 83=S
    if ($pho ne chr(32)) {   # 2017-04-30: if not 32=SPACE
      if ($pho ne chr(83)) { # 2017-04-30: if not uppercase "S"...
        $num = 1;  # 2017-04-30: tentative assignment of singular num(ber)
      } # 2017-12-18: end of test for "S". 
    } # 2017-04-30: end of space-test needed because of any $tult before SPACE. 
    if ((ord $pho) < 33) {  # 2017-04-30: if not an alphabetical character
      if ($endpho eq chr(83)) { $num = 2 }  # 2017-04-30: if final 83=S
    } # 2017-12-18: end of test for a non-alphabetic character
    if ((ord $pho) > 31 || (ord $pho) == 13) {  # 2017-12-16: 13=CR carriage return
      if ($len == 1 && (ord $pho) != 32) {  # 2017-09-24 BUGFIX: no $rv for 32=SPACE
        $rv = $t;  # 2017-12-16: for a word of a single letter.
      }  # 2017-04-07: end of more complex setting of value.
      if ($len == 0) { $audrec = 0 }  # 2017-04-05: prevent carry-over.
        if ($len > 0) {  # 2017-04-1: if incoming word already in progress.
          $endpho = $pho;  # 2017-04-30: keep track of previous character, for $num
          if ((ord $pho) == 32 || (ord $pho) == 13) { $len++ }  # 2017-12-18: increment
        }  # 2017-04-01: end of test for at least a one-character word
        AudMem();  # 2018-09-27: for English or Russian input.
      }  # 2017-03-30: end of conditional test for entering or reentering character
      if ((ord $pho) == 13) {  # 2017-03-30: CR-13 carriage-return
        $pho = " ";    # 2016-06-24: use SPACE for recognition of word. 
        $audrun = 1;   # 2017-03-30: Reset to one at CR end of input.
        $eot = 13;     # 2017-03-30: end of transmission (EOT)
        print chr 10;  # 2017-03-30: ASCII linefeed LF-10
      }  # 2017-03-30: end of test for Enter-key carriage-return.
      if ((ord $pho) == 32 || (ord $pho) == 13) {  # 2017-03-30: after SPACE or CR...
        $audrun = 1;  # 2017-03-30: Reset to unity at end of a word.
        $spt = $t;    # 2017-03-30: set time-of-SPACE "spt" to current time "t".
        $tult = $t - 1;  # 2017-03-30: for storage at prior-by-one time-point.
        if ($monopsi > 0) { $audpsi = $monopsi }  # 2017-06-24
        if ($audrec > 0) { $audpsi = $audrec }  # 2017-06-24
        if ($audpsi > 0) {  # 2017-03-30: if a word has been recognized...
          $sublen = 0;      # 2017-03-30: length of AudRecog subpsi word-stem
          $oldpsi = $audpsi;  # 2017-03-30: transfer value for OldConcept().
          $audpsi = 0;      # 2017-03-30: re-set to prevent carry-over. 
          $prc = 0;         # 2017-03-30: reset provisional recognition "prc";
          OldConcept();     # 2017-03-30: call module for recognized concepts. 
          $rv = 0;  # 2017-09-22: so new $rv may be set
        } else {    # 2017-03-30: if no old concept is recognized...
          if ($len > 0) {   # 2017-03-30: if dealing with a word of positive length...
            my @aud=split(',',$ear[($t)]);  # 2017-03-31: break apart @aud row
            $ear[$t] = " ,$aud[1],$aud[2]"; # 2017-03-31: store 32=SPACE
            NewConcept();  # 2017-03-30: create new concept with number "nxt".
            $rv = 0;       # 2017-09-22: so new $rv may be set
            @aud=split(',',$ear[($t)-1]);  # 2017-03-31: avoid "my" twice
            $ear[$t-1] = "$aud[0],$aud[1],$nxt";  # 2017-03-30: As in MindForth AI
            if ($len > 1) { $nxt++; }  # 2017-04-23: like MindForth here, not NewConcept()
          }  # 2017-03-30: end of test for a positive word-length.
        } # 2017-03-30: end of test for a recognized audpsi concept. 
        AudDamp(); # 2017-03-30: de-activate auditory memory in advance of next word.
      }  # 2017-03-30: end of test for 32=SP or 13=CR to make sure word has ended
    } # 2017-06-23: end of test for reentrant pov=1
    ReadMode('normal');  # PBlackBook p. 543
    if ($pov == 2)  {  # 2017-04-02: only during external input...
      $msg = $msg.$pho;  # 2017-03-25: concatenation, Perl Black Book p. 149
    }  # 2017-04-02: end of test for accumulating only user input
    if ($pho eq "\r") { $eot = 13; print "\n"; } # 2017-12-26: end of transmission
    ReadMode('normal');  # PBlackBook p. 543
    if (ord $doa == 13) {  # 2017-03-25: Perl Black Book p. 354 ASCII "ord"
      $pho = " ";  # 2017-04-01: convert CR-13 to SPACE-32
      $doa = 0;  # 2017-03-26: Reset to prevent carry-over.
      $hear = 0;  # 2017-04-02: reset the main AudInput() loop.
    }  # 2017-03-25: end of test for CR-13 to make early exit from loop.
    if ($unk eq chr(27)) { die "TERMINATE: ESCape key for quit. \n"; } # 2017-03-24
    $pho = "";  # 2017-03-24: From MindForth: must be reset to zero each time.
    ReadMode('normal');  # PBlackBook p. 543
    $homo = $msg;  # 2017-03-25: for HCI in Sensorium
    if ($unk eq chr(10)) { print "End of input \n"; last }  # 2017-03-23
    if ($reentcon == 1)  { $msg = $idea }  # 2017-03-26: from ReEntry()
    if ($pho eq chr(27)) { die "TERMINATE: ESCape for quit. \n"; } # 2017-03-18
    if ($pho eq "\n") { $eot = 1 }  # 2016feb01: for escape from outer loop.
    if ($pho eq "\n" && $msg eq "") { $trigger++ } # 2016apr29
#   if ($t > $cns) { die "Safety stop: out of memory \n"; }  # 2016apr09
#   if ($t > $cns) { die "Safety stop: out of memory \n"; }  # 2018-11-08
    if (ord $pho == 13 || ord $pho == 32) { #2017-03-30
      if ($audnew == 0) {$audnew = $t};  # 2016feb09 Set only once. 
      if ($fyi > 2 && $hlc == 3) {     # 2018-09-27: if mode is Diagnostic 
        print "  pho $pho is an alphabetic letter \n";  # 2016jan29
      }  # 2016feb07: end of test for Diagnostic or Tutorial mode.
      if ($fyi > 2 && $hlc == 3) {     # 2018-09-27: if mode is Diagnostic 
        print " AudInput: increasing len(gth) to $len \n";  # 2016jan31
      }  # 2016feb07: end of test for Diagnostic or Tutorial mode.
      if ($len < 1) { $audrec = 0 }  # 2017-03-16: prevent carry-over.
      if ($len < 1) { $audpsi = 0 }  # 2017-03-16: prevent carry-over.
      if ($len == 1 && $rv == 0) { $rv = $t }  # 2017-09-24: set recall-vector.
    }  # 2017-03-31: removing else-block from code above
    if ($len == 1) { $rv = $t }  # 2017-09-10: TEST; CORRECT BUG?
    if ($audnew == 0) { $audnew = $t }   # 2018-09-27: Set only once. 
  } # 2017-12-27: end of test for $pov==1 (during re-entry of output).
  $pos = 0;      # 2016mar12: Reset to prevent InStantiate() carry-over.
  $pre = 0;      # 2016mar12: Reset to prevent InStantiate() carry-over.
  $psi = 0;      # 2016mar12: Reset to prevent InStantiate() carry-over.
  if ($pho eq "\n") { $eot = 1 }  # 2016feb01: for escape from outer loop.
  $monopsi = 0;  # 2016feb06: zero out to prevent carry-over
  if ($audpsi > 0) {       # 2016jan30: would be from AudRecog()
    $oldpsi = $audpsi; # 2016jan30: JSAI: for conformance with MindForth
    $audpsi = 0;  # 2016feb04: zero out to prevent carry-over
    $prc = 0;  # 2016feb06: as is done in the JavaScript AiMind.html
  }  # 2017-03-30: for termination of code commented out
  $audpsi = 0;  # 2016jan30: reset for safety
  $eot = 0;  # 2016feb02: Reset to zero for the sake of whole sentences. 
  $audpsi = 0;  # 2016jan30: reset for safety
  $phodex = 1;  # 2016apr03: reset for AudBuffer();
  $psi = 0;  # 2016mar12: Reset to prevent carry-over.
}  # 2017-03-29: AudInput() returns to Sensorium() or Speech().

5. Variables

$audnew -- holds the onset-tag while the rest of a word comes in.

$audpsi -- concept number of English or Russian word in @ear auditory memory array.

$audrec -- auditory recognition concept-number

$audrun -- in the AudRecog() module, which increments audrun, it is a counter of how many times the incrementing module has been called. If the audrun count is at unitary one or below two, then the initial character at the start of a word is being processed. audrun is reset to one in the AudInput() and FileInput() modules.

$doa (dead on arrival)-- flag for exiting from the AudInput() loop.

$endpho -- final input character (or phoneme) captured and checked for being an "S" which might indicate that an input noun is plural in number.

$eot -- end-of-transmission for end of input.

$fyi -- (for your information) 0 = bare-bones (without prompt); 1 = Normal; 2 = Transcript; 3 = Tutorial mode; 4 = Diagnostic mode

$gapcon -- status-con flag for AudInput() to count down gaps of no input, so that internal thinking may accelerate during periods of no input from external sources.

$hear -- loop counter for the ghost.pl AudInput() module to call AudListen() enough times to give the user an opportunity to enter input.

$hlc -- human-language code; 1=en; 2=de; 3=ru. Subject to override by the $engov or $degov or $rugov flag.

$homo -- for the human-computer interface (HCI), whatever the Homo Sapiens user has input.

$impetus -- an accumulating variable to hold the activation-level of a trigger to initiate action by the FreeWill Volition() module.

$iob -- indirect-object tag for @psy concept array.

$isolation -- counter of thought-cycles spent in "isolation" with no human input, as an arbitrary trigger for output by the AI Mind, or as a threshold for the AI to take certain actions if input suddenly appears.

$len -- length, for avoiding input non-words. The len variable increments with each additional character during AudInput, and is reset to zero at the end of InStantiate or OldConcept or NewConcept, so that the auditory engram recall vector rv may be set for the first character of a word when the word-length is a unitary one.

$monopsi -- for detecting single-character words in the AudRecog() module.

$msg -- for input as a "message" to the AI.

$num -- number-flag for grammatical number.

$oldpsi -- used in OldConcept to de-globalize "psi".

$pho -- a "phoneme" or character of auditory input.

$phodex -- pho-index counter for AudBuffer(); phodex is reset to unitary one ("1") in the AudInput module and in the Speech module.

$pos -- (part of speech) 1=adj 2=adv 3=conj 4=interj 5=noun 6=prep 7=pron 8=verb

$pov -- point-of-view: 1=self; 2=dual; 3=alien. When pov=1, the word "you" is somebody in the external word. When pov=2, the word "you" refers to the self-concept "I" in the AI. When pov=3, the word "you" is interpreted as part of a conversation by a third-party or as a word in a text, not referring to the self-concept of either the AI or of someone talking to the AI.

$prc -- provisional recognition in AudRecog()

$pre -- pre(vious) associated @psy concept.

$psi -- variable for an element of the @psy conceptual array, with a numeric identifier serving as an "mtx" machine-translation tag for the same concept in another language.

$reentcon -- possibly obsolete reentrant condition flag once used for test purposes.

$rv -- recall-vector for auditory memory. The time-point value of rv is first set in the AudInput module after an intervening space when the first character of an input-word is being passed into the AudMem module. The recall-vector rv is reset to zero in AudInput after a call to OldConcept or to NewConcept.

$spt -- blank space time before start of a word in auditory memory.

$sublen -- length of AudRecog() subpsi word-stem

$t -- lifetime Ghost AI experiential time "$t"

$text -- a general variable to hold text, especially for incrementing by concatenation.

$tio -- time-of-indirect-object for parser module.

$tsn -- time of input as $seqneed time for InStantiate()

$tult -- t penultimate, or time-minus-one.

$unk -- all-purpose $unk (unknown) for troubleshooting


6. Troubleshooting and Robotic Psychosurgery

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


7. Future Development

The AudInput mind-module must eventually change from receiving input from the computer keyboard to hearing actual acoustic sounds and processing human speech.


8. Resources

Please see also

http://mind.sourceforge.net/audition.html


9. AiTree of First Working AGI Mind-Modules


Return to top; or to
Tiananmen Square IV VI
javascript subreddit for AI Mind discussion;
Forth subreddit for MindForth discussion;
Perl subreddit for ghost.pl AI Mind Maintainers.
http://old.reddit.com/r/ControlProblem -- NOT SOLVED.
http://en.wikipedia.org/wiki/Natural_language_understanding -- solved.
Iskusstvenny Intellekt Programming Journal for Artificial Intelligence in Russian Language.
Converting ancient Latin AI into modern Russian AI
http://ai.neocities.org/Dushka.html -- tutorial Russian AI;
If you have any questions about the First Working AGI, please Join the Discussion.
Joint Artificial Intelligence Center (JAIC) -- the AI Manhattan Project.
Subject to change without notice.
Many thanks to NeoCities.
http://neocities.org/blog
http://trollheaven.blogspot.com