AudRecog

Mind-Module of Ghost.pl and MindForth Strong AI

1. Diagram of AudRecog Mind-Module

   /^^^^^^^^^\  Auditory Recognition of "c-a-t-s"  /^^^^^^^^^\
  /    EYE    \ REACTIVATED                       /   EAR     \
 /             \ CONCEPTS                        /"CATS"=input \
|   _______     |   | | |    SEMANTIC MEMORY    |               |
|  /old    \!!!!|!!!| | |                       |  C     match! |
| / image   \---|-----+ |             ___       |  -A    match! |
| \ fetch   /   |   |c| |            /   \      |    R    stop  |
|  \_______/    |   |a| |           /     \     |     S   drop  |
|               |   |t| |          / Old-  \    |               |
|  visual       |   |s| |         ( Concept )   |  C     match! |
|               |  e| | |          \       /    |  -A    match! |
|  memory       |  a| | |          /\     /!!!!!|!!!!T   match! |
|               |  t| | |   ______/  \___/------|-----S  recog! |
|  reactivation |   | |f|  /      \             |               |
|               |   | |i| ( Parser )            |  C     match! |
|  channel      |   | |s|  \______/             |  -A    match! |
|   _______     |   | |h|      |                |  --T   match! |
|  /old    \    |   |_|_|     _V_________       |  ---S   busy  |
| / image   \   |  /     \   /           \      |      U  drop  |
| \ store   /---|--\ Psi /--( InStantiate )     |       P drop  |
|  \_______/    |   \___/    \___________/      |               |


2. Algorithm

The AudRecog() module uses quasi-neuronal activation to recognize words by matching up a chain of activated phonemes until the end of a word of input is reached and a matching word in auditory memory is either found, resulting in a call to the OldConcept mind-module, or not found, resulting in a call to the NewConcept mind-module.

The ghost.pl AI Mind in Perl uses an AudRecog() algorithm much simpler in construction than the older algorithm used in the older AI Minds. Since the introduction of the Perl AI, the @aud auditory array no longer uses the beg flag to hold on to the beginning of a word in memory, or the ctu continuation-flag to indicate whether a word continues from one phonemic character to the next. Instead, the ghost.pl AI and the newer versions of the MindForth AI dynamically ascertain whether a phonemic character is the beginning of a word in memory, and whether a phonemic character is the final character of a word stored in the auditory memory.

AudRecog() must eventually make the switch from keyboard entry of characters as if they were phonemes and morphemes, to actual acoustic input of sound-wave phonemes and morphemes.


3. Code of AudRecog() from ghost.pl AI Mind in Perl

sub AudRecog() {  # http://ai.neocities.org/AudRecog.html
# if ($pho ne chr(32)|| $pho ne chr(13)) { # 2017-03-15: if incoming word continues
  if ($pho =~ /[A-Z]/) {   # 2017-03-16: different from test in MindForth
# if ((ord $pho) > 0) {  # 2017-04-01: CR, SPACE or alphabetic letter
    if ($audrec  > 0) {  # 2017-03-16: if positive $audrec before end of word...
      # print "    AudRecog-start: at t= $t pho= $pho audrec= $audrec \n"; # 2017-03-16
      if ($pho ne chr(83)) {  # 2017-03-15: keep audrec if current pho is 83=S  
        $audrec = 0;  # 2017-03-16: zero out non-final audrec.
      }  # 2017-03-15: end of test for final "S" as inflectional ending.
    }  # 2017-03-15: end of test for $audrec before word-end
  }  # 2017-03-15: end of test for an alphabetic character
  if ($pho eq chr(32) || $pho eq chr(13)) {  # 2017-03-15: 32=SPACE or 13=CR 
    if ($fyi == 4) {  # 2017-04-05: show message only during Diagnostic Mode
      print " AudR after audrec= $audrec finds SP-32 or CR-13 \n";  # 2017-04-05:
    } # 2017-04-05: end of test for fyi=4 Diagnostic Mode.
    if ($audrec > 0) {  # 2017-03-15: if positive audrec before 32=SPACE...
      $audpsi = $audrec;  # 2017-03-15: recognized item becomes storage item.
      return;  # 2017-03-15: [Forth EXIT?] skip body of AudRecog; return to AudMem
    }  # 2017-03-15: end of test for a positive audrec before 32=SPACE
  }  # 2017-03-15: end of test for a positive audrec before 32=SPACE
  for (my $i=$spt; $i>$midway; $i--) {  # 2017-03-15: search backwards in time.
    if ($pho ne chr(32)) {  # 2017-03-15: disregard 32=SPACE pho until end of input. 
      my @aud=split(',',$ear[$i]);  # 2017-03-15: separate @ear rows into parts.
      if ($pho ne $aud[0]) { $ear[$i] = "$aud[0],0,$aud[2]" }  #2017-03-15: de-activate
      if ($pho eq $aud[0])  { # 2017-03-15: If incoming pho matches stored aud0;
        if ($aud[1]==0) { # 2017-03-15: if matching engram has no activation;
          my @prv=split(',',$ear[$i-1]);  # 2017-03-15: "@prv" for "previous" row.
          if ($prv[0] !~ /[A-Z]/) {  # 2017-03-15: "if previous engram not a letter..."
            if ($audrun < 2) { # 2017-03-15: "if comparing start of a word"
              my @nxr=split(',',$ear[($i+1)]);  # 2017-03-15: for next-in-line char
              if ($nxr[0] =~ /[A-Z]/) {   # 2017-03-15: if next engram is a letter...
                $ear[$i+1] = "$nxr[0],8,$nxr[2]"; # 2017-03-15: "activate N-I-L character"
              }  # 2017-03-15: end of test for continuation of stored comparand. 
              my @aud=split(',',$ear[($i)]);  # 2017-03-15: for current char
              if ($aud[2] > 0)  {  # 2017-03-15: if concept number present
                $audrec = $aud[2];  # 2017-03-15: automatic recog for single char.
              }  # 2017-03-15: end of test for potential monopsi ultimate-tag
            }  # 2017-03-15: "end of test for audrun=1 start of word"
          }  # 2017-03-15: "end of test for a beg(inning) non-active aud0" 
        }  # 2017-03-15: "end of test for matching aud0 with no activation"
        my @aud=split(',',$ear[$i]);  # 2017-03-15: break apart @ear auditory array.
        if ($aud[1] > 0) {  # 2017-03-15: "If matching aud0 has activation"
          my @nxr=split(',',$ear[($i+1)]);  # 2017-03-15: for next-in-line char
          if ($nxr[0] !~ /[A-Z]/) { # 2017-03-15: if at end of stored word; not a letter
            if ($aud[2] > 0) {  # 2017-03-15: check for an audpsi tag
#             $audrec = $aud[2]; # 2017-03-15: provisional recognition of a stem 
              $prc = $aud[2]; # 2017-10-20: provisional recognition of a stem 
#             last;  # 2017-03-16: beyond MindForth -- only fetch most recent recognition?
#             last;  # 2017-10-20: do not let recog of "ME" interfere with "MEN"!
            }  # 2017-03-15: end of test for an available audpsi.
          }  # 2017-03-15: end of test for next-in-line non-alphabetic character.
          if ($fyi == 4) {  # 2017-04-05: show message only during Diagnostic Mode    
    print "      AudRecog: at i- $i checks SPACE or CR audrec= $audrec \n" # 2017-04-05
          }  # 2017-04-05: end of test for fyi=4 Diagnostic Mode.
          if ($pho eq chr(32) || $pho eq chr(13)) { # 2017-03-15: no report until SPACE or CR 
            if ($audrec > 0) {  # 2017-03-15: if an audrec has been found...
              $audpsi = $audrec;  # 2017-03-15: send audpsi into AudMem
            } # 2017-03-15: end of test for a positive audrec
          }  # 2017-03-15: end of test for SPACE-32 or CR-13
          $audrec = 0;  # 2017-03-15: disallow audrec until last letter of word.
          if ($pho ne chr(32)|| $pho ne chr(13)) { # 2017-03-15: if not CR or SPACE
            my @nxr=split(',',$ear[($i+1)]);  # 2017-03-15: for next-in-line char
            if ($nxr[0] =~ /[A-Z]/) {   # 2017-03-15: if next engram is a letter...
              $ear[$i+1] = "$nxr[0],8,$nxr[2]"; # 2017-03-15: "activate N-I-L character"
            }  # 2017-03-15: since next engram is a letter...
          }  # 2017-03-15: end of test for 32-SPACE after input word.
        }  # 2017-03-15: "End of test for matching aud0 with activation."
      }  # 2017-03-15: "End of test for a character matching 'pho'."
    }  # 2017-03-15: end of test for alphabet letter 
  }  # 2017-03-15: End of backwards search through auditory memory. 
  $audpsi = $audrec;  # 2017-03-15: TEST; REMOVE
  if ($prc > 0) {    # 2017-10-20: 
    $audrec = $prc;  # 2017-10-20: from Dushka RuAi; prov. recog;
    print   " AudR: t= $t audrec= $audrec prc= $prc pho= $pho \n"; # 2017-10-20
  }  # 2017-10-20
# print "    AudRec-end: t= $t pho= $pho audpsi= $audpsi audrec= $audrec \n"; # DIAGNOSTIC?
  $audrun++;   # 2017-03-15: audrun is only a counter, not a factor.
}  # 2017-03-15: End of AudRecog(); return to AudMem()


4. Debug

A team of AI Mind Maintainers may debug the AudRecog() module by first inserting, and later commenting out, diagnostic messages to inform the AI coder what is happening inside the AudRecog() module at various stages of its operation, and what values are carried by variables used within the AudRecog() module.


5. Resources

Please see

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


Return to top; or to
mindforth source code
http://ai.neocities.org/maintainer.html