Manual for running Perl6 artificial intelligence killer app


1 Introduction

The Perl6 artificial intelligence (P6AI) begins life as a Perl 5 application running under Microsoft Windows. Perl6 was released near the start of 2016 and must become more widely available on multiple platforms before the AI Perlmind may migrate from Perl5 to Perl6. For any new programming language, true artificial intelligence or Strong AI is automatically a killer app.

http://ai.neocities.org/AiSteps.html describes the AI steps for creating the P6AI killer app in Perl.

http://ai.neocities.org/perlmind.txt is the original Perl5 AI source code under construction.


2 Getting Started

http://www.perl.org/get.html presents a choice among the Unix/Linux, MAC OS X, and Windows operating systems. This Perl AI Manual currently covers Strawberry Perl5 for a Windows platform. After you download and install Perl in a C:\Strawberry directory, you may download the http://ai.neocities.org/perlmind.txt source code into either the Strawberry directory or a subdirectory such as C:\Strawberry\perl_tests and then rename the perlmind.txt file as either mind.pl or as a version identifier such as mind0029.pl so that the code will run when called as a Perl program.

To run the mind.pl code, after opening an MS-DOS command prompt window, you should first use cd.. to "change directory" as many times as necessary towards the root C:\ directory. Then you should use cd Strawberry to change to the Strawberry directory containing perl, and from there to any necessary subdirectory by entering cd perl_tests or the name of any subdirectory containing the mind.pl code that you wish to run.

C:\Strawberry\perl_tests>dir will take a directory and show you the creation-time, size in bytes, and name of whatever source-files you have in the directory, plus any two-line input.txt file or other input file that you have saved into the directory for the AI program to read into itself in lieu of keyboard input (see below).

C:\Strawberry\perl_tests>perl mind0029.pl (or newer version) when entered, will run the Perl source code file of the Perl AI Mind program.

C:\Strawberry>perl perl_tests\mind0029.pl (or newer) will run the program in the indicated subdirectory, inasmuch as you have provided an access path by including the name of the subdirectory containing the desired program.pl file.

Once it starts running in the MS-DOS command prompt window, the AI Mind will interact with you until it runs out of memory space. If the AI has been coded to react to the keyboard "Escape" key, it may be possible to terminate the program by pressing Escape.


3 Entering Input

In the early stages of the construction of the Mind.pl program, you may type in a word such as "boys", then "play" and then "games" to tell the AI that "boys play games." The program will go about storing the words in auditory memory and at the end will show you the contents of the auditory memory, along with associative tags that connect words as concepts instantiated in a mind.

In the more mature AI Minds such as MindForth or the JavaScript AiMind.html program, once you tell the AI that "boys play games" and you enter a fact such as "John is a boy", the InFerence module will engage in machine reasoning and ask you, "Does John play games?" The Perl AI is on its way to the same level of reasoning.

3.1 Using a file instead of a keyboard for input

The Perl AI has acquired a method of getting its input from a nearby input.txt file instead of across the keyboard from a human user. Since Perl makes it difficult to respond dynamically to each individual character of keyboard input, as is done in the Forth and JavaScript AI Minds, we Perl killer app AI programmers are nudged or encouraged into accepting the likelihood that an emerging Strong AI superintelligence will more likely be digesting computer files and websites most of the time and not interacting dynamically with human operators. A human might interact with the AI by submitting a text message or an e-mail, even a tweet.

Initially the Perl AI deals with an input.txt file in the same directory along with the perlmind.pl source code:

boys play games
john is boy
This input.txt file, or one like it, must be composed in an editor and saved into the same directory with the Perl AI code, so that the AI can read in the contents of the input file. Note that using "boys play games" and "john is (a) boy" as input makes it possible for the AI eventually to reason about the input and to infer a logical conclusion from it and to ask itself whether John plays games since John is a boy.

One good improvement to the Perl AI code would be to offer the human overseer four choices for input: input.txt as a default file to be examined by the AI; any other filename to be entered by the human user; human entry by computer keystroke across the keyboard; and true sensory acoustic input by speech-to-text conversion. Note that we may start out with a simple two-line input.txt file, but the same AI that can read two lines of input from a file demonstrates the innate ability to read a thousand-page novel by Tolstoy, or the entire corpus of Wikipedia, or any compendium of knowledge freely available on the World Wide Web.


4 Selecting a human language

Although the Perl AI coding is still primitive, it is anticipated that webserver-resident AI Minds in Perl will detect the language of human input as English or German or Russian or whatever else, when recognized words reset the human-language-code $hlc.

The $hlc human-language-code will govern which human language the Perl server-mind chooses to think in. When the P6AI or P5AI is receiving words as input and one or more words in a row are already known to the AI, the recognition of the known word or words will set the $hlc-flag to the language of the input word. Thus the AI is not only recognizing the word, but the language of the word. The $hlc-flag will cause the Perl AI to think in the same language as the input is couched in. Since the previous AI Minds (being ported into Perl) can already think and reason with logical inference in English, in German, and in Russian, an AI Perlmind that originally thinks in English can be expanded to think also in German and in Russian.

4.1 Using English with the Perl artificial intelligence

We may use English as the default language of the AI Perlmind, although any system administrator (sysadmin) in charge of the care and feeding of a Perl AI may switch to any other human language as the system default.

Netizens who use Microsoft Internet Explorer may point the MSIE browser at the JavaScript AI Mind that thinks and reasons in English to see how an AI Perlmind is supposed to behave.

4.2 Using German with the Perl artificial intelligence

Coders and maintainers of a polyglot Perl webserver AI may either adopt the character set of the German language with its umlauts and its "s-zet", or they may simply spell German words with standard Roman letters that add an "e" as in "Tannhaeuser" for an umlaut and use "ss" as in "dass" for the combined "s" and "z" character.

http://de.perl6intro.com talks about Unicode.

The Kindle e-book "Artificial Intelligence in German" describes the German-thinking AI "Wotan" that is built upon the same Forth code from which the Perl AI is being created as a port from MindForth.

German-speakers may read blog-posts about the German AI which is like a cousin to the emerging Perl AI:


4.3 Using Russian with the Perl artificial intelligence

The JavaScript AiMind.html has been ported into the Russian Dushka artificial intelligence with its Russian-language User Manual. To interact with the Russian AI, Netizens may use a Russian keyboard or may change their Microsoft Windows settings to use Alt-Shift to toggle between English and Cyrillic as their chosen keyboard alphabets. Even the primitive, still emerging Perl AI puts Russian characters into memory if the user presses Alt-Shift to toggle into Russian and then Alt-Shift again to toggle back out of Russian.

The website http://perl.find-info.ru/perl/028/perlbp-chp-17-sect-10.html has Russian-language material on how to learn Perl.


5 Troubleshooting

There are future career opportunities for skilled personnel who can maintain and debug or troubleshoot the Perl6 killer app of Strong AI. Any change to a P6AI installation may require intensive troubleshooting.

5.1 Built-in Precautions

As long as your P5 or P6 AI source code starts with use strict; and use warnings;, the code itself will help you to troubleshoot the AI functionality by protecting you from yourself as an AI programmer.

5.2 Make use of error-message line-numbers.

If you run the P5AI or P6AI code and it objects to any snippet of code identified by its line-number in the code listing, you may often zero in on the problem in a text-editor such as Notepad by clicking inside the code so that the "Line" and "Column" will be stated for you at the bottom of the screen. Then you may have a better idea of exactly what the problem is.

5.3 Commenting-out code to observe what happens

If you identify a particular line of Perl Strong AI code where there is a problem, you may insert "#" in front of the line so as to "comment out" the line and make it inoperative. If you then discover that the actual problem lies somewhere else, you may remove the "#" symbol and return the code to operational status. As you may notice in early releases of the Perl killer-app AI, it is helpful, when changing or replacing a line of code, to comment out the old line and keep it visible above the new line through at least one iteration of the process of releasing the AI source code. Thus mission-critical-AI code-maintainers may not only see what has been changed but perhaps also why the change has been made.

5.4 The glob Function

Do not be frightened if the word "glob" appears. It is an actual Perl function involving filenames.




Return to:
InFerence -- e-book
The Art of the Meme e-book
http://irclog.perlgeek.de/perl6/2016-01-09
AI Steps -- DIY Strong AI with step-by-step examples in Perl
Artificial Intelligence: Law and Policy
Mentifex asks White House Deputy Technology Chief Ed Felten to point out technology reporter
John Markoff of the New York Times at the Artificial Intelligence: Law and Policy workshop.