Speech module of the

First Working AGI Mind in JavaScript

MindForth for robots -- ghost.pl for webservers


1. Diagram of the Speech Mind-Module

   /^^^^^^^^^\Speech module says auditory phonemes /^^^^^^^^^\
  / visual    \               __________          / auditory  \
 /  memory     \          |  / Volition \        /  memory     \
|   _______asso-|ciative  |  \__________/       |  ___________  |
|  /image  \rec-|ognition |    ___|_____        | / MindBoot  \ |
| / percept \---|---------+   / EnThink \       || memory vault||
| \ engram  /   |tag     c|f  \_________/       ||             ||
|  \_______/    |        o|i   ____|_______     || "students"  ||
|               |        n|b  / Indicative \    || "read"      ||
|               |        c|e  \____________/    || "books"     ||
|               |        e|r _______|_______    | \___________/ |
|               |        p| / EnNounPhrase  \   |               |
|   _______     |        t| \_______________/   |   ________    |
|  /fresh  \    |     ____V_        _|_____     |  /        \   |
| / image   \   |    / Psy  \      /       \    | / aud      \  |
| \ engram  /---|---/concepts\    / Speech  \---|-\ phonemes /  |
|  \_______/    |   \________/    \_________/   |  \________/   |



2. Purpose

The purpose of the Speech module is to output words of natural language as text on-screen or as phonemic sounds.


3. Algorithm

The Speech module outputs characters as phonemes from any given starting point in auditory memory until the end of a phonemic engram.


4. Code of Speech() from ghost.pl First Working AGI in Perl

# 2015may28 Requirements of Speech mind-module:
# Speech module shall output a single word starting at given @ear point. 
# Outputted word shall be fed internally into the ReEntry module. 
# Inflected nouns and verbs shall be spoken from NounGen or VerbGen.  
sub Speech() {  # http://ai.neocities.org/Speech.html
  if ($age > $cns) { die "TERMINATING: memory full \n"; }  # 2016jan28
  $pho = " "; AudInput(); # 2017-12-07: prime AudInput with a 32=SPACE
  $audstop = 0;  # 2017-03-31: Initially false value of flag
  $pov = 1;    # 2017-03-27: only internal POV thinking uses speech module.
  $t2s = $aud;  # 2016feb13: start from the auditory recall-vector $aud
  $rv = 0;  # 2017-04-07: [MindForth] Let AudInput designate recall-vector "rv".
  do {        # PERL by Example (2015), p. 194: do/until Loops
    my @aud=split(',',$ear[$t2s]);  # 2016jan28: expose @ear values
    $output = "$output" . "$aud[0]";  #2016apr09: commenting back in
    print "$aud[0]";  # 2016mar29: say each character
    $pho = $aud[0];  # 2017-03-27: for reentry into AudInput.
   if ((ord $pho) == 0) {  # 2017-03-31: if space detected...
     $pho = " "; # 2017-03-31: blank SPACE-32
     $audstop = 1;  # 2017-03-31: flag to end a word with a space
   }  # 2017-03-31: end of test for a blank space.
    if ((ord $pho) == 13) {  # 2017-03-31: including any 32=SPACE...
      $pov = 2; # 2018-07-01: after 32=CR (carriage return)
      print $pho;  # 2017-12-21: say or display "pho"; TEST
      $lastpho = $pho;  # 2017-03-31: to avoid extra "S" on verbs 
    }  # 2017-03-31: end of constantly keeping track of last pho.
    if ((ord $pho) == 32 || (ord $pho) == 13) {  # 2017-03-31: SPACE or CR
      $audstop = 1;   # 2017-03-31: flag for finding end of word
      $spacegap = 1;  # 2017-03-31: identify presence of a space
      print $pho;  # 2017-03-31: say or display "pho" 
    }  # 2017-03-31: end of test for 32=SPACE or 13=CR.
    AudInput();  # 2017-03-27: input each phoneme, not entire idea.
    if ($audstop == 1) {  # 2017-03-31: flag found for end of word?
      if ($spacegap == 1)  {  # 2017-03-31: space found?
        $t++;  # 2017-03-31: increment internal AI time "t"
        $audrun = 1;  # 2017-03-31: resetting at end of internal word.
        $pho = " ";  # 2017-04-01: send SPACE-31 into AudInput?
        AudInput();  # 2017-04-01: one last call to AudInput()
        $len = 0;  # 2017-06-20: at end of word, reset length $len; 2017-06-20
        $t++;      # 2017-06-20: increment time-t by one unit? TEST
        $spacegap = 0;  # 2017-03-31: reset
      }  # 2017-03-31: end of test for a space.
    }  # 2017-03-31: end of test for end-of-word flag.
    $pov = 1;    # 2016apr08: internal point-of-view during thinking.
    $t2s++ ;   # 2016mar10: Increment time-to-speech to advance thru memory. 
    if ($aud[0] eq " ")  { # 2016apr29: if no character is found
      $audrv = $t2s;  # 2015may13: Prepare for next word in memory.
      if ($pho eq chr(13)) { $pov = 2 }  # 2017-03-31: for sake of pause-counter
      return;         # 2015may13: Exit at end of a word
    };  # 2015may13: End of if-clause
  } until $t2s eq $cns;  # Show the whole array of AI Mind memory.
  $phodex = 1;  # 2016apr03: reset for AudBuffer()
}  # Speech() returns to EnNounPhrase() or other generative module. 


5. Troubleshooting and Robotic Psychosurgery

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


6. Variables

$age -- temporary age for loop-counting.

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

$audrv -- auditory recall-vector for Speech mind-module.

$audstop -- flag to stop Speech module after one word. The Speech module lets a CR-13 carriage-return or a SPACE-32 change the audstop flag from its zero value at the start of Speech to a unitary one (1), so that audstop and spacegap may work together to send the final non-letter into the AudInput module.

$cns -- (adjustable) size of "central nervous system" memory in the First Working AGI.

$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 OldConcept and NewConcept.

$lastpho -- device to avoid extra "S" on verbs.

$output -- output string as in JavaScript FirstWorkingAGI.html or ghost.pl AGI.

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

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

$spacegap -- a gap to add one post-word space in the Speech module.

$t2s -- auditory text-to-speech index.


7. Future Development

The Speech module needs to be converted from displaying text on-screen to outputting phonemic speech sounds.


8. Resources

Please see

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

http://cyborg.blogspot.com/search/label/Speech -- is a special weblog URL which invites Netizens to view blog-posts discussing the Speech mind-module.

https://browser-speech-support.firebaseapp.com


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.