|
25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more... |
Home Projects Up Sitemap Search Blog Forum+Chat About Us Privacy Terms of Use Feedback FAQ Images Services Ads Donate Humor |
|
|
Borland OWL C++ Natural Language Processing chatbot program and database[The download link is farther down this page.] WTalk.cpp is a monster of a program written in Borland C++ 4.0 and ObjectWindows Library (OWL) 2.0 for Windows 3.1. There is also an older version for Borland's EasyWin Windows console interface.
WTalk.cpp is partly an Eliza-like chatbot or chatterbot program that converses with the user. Like Eliza, it takes the role of a psychotherapist. My interest at one time was Gestalt psychology, and more than a few of its responses come from that tradition. It's not a very interesting conversation partner, however, because I spent most of the development time on the parts of the program that attempt to do natural language processing of your input: The program performs grammatical parsing of the user's input, using a combination of methods. It displays the result of its parsing attempt in a separate window, and allows the user to optionally revise it. After revision, if the user indicates that the sentence is now grammatically correct, the program stores its grammatical structure in a database of known-good constructions. During parsing, the program tags words and phrases by what type of informational content they contain (who, what, when, where, why, ...), and stores the results in an array of a class called FACT. You can ask the program factual questions about things you've said previously. It attempts to match what you seem to be asking about against its collection of facts, using some odd and surprisingly successful matching methods that do not attempt perfection, but instead try to be as relevant as possible as much of the time as possible, and presents you with those facts that seem to answer your question best. The program stores almost all of its data in a Microsoft Access database (WTalk.mdb), which it maintains using SQL commands delivered to Access through Windows Dynamic Data Exchange (DDE). The program's responses to your input are generated using a rule-based lottery system that works like the lottery in a classifier system. Rules that pertain to the current situation as determined by internal program state variables bid against each other for the opportunity to generate the reply. The winning rule runs its subroutines, which generate the reply. The user then has the opportunity to score the program's output, and the rule that generated the reply is rewarded or punished based on the user's score. A rule whose reply receives positive feedback is strengthened, and is more likely to win the next time that situation arises. Conversely, a rule that is punished becomes weaker. Including all the library routines that it uses, but not counting the development of the database, the program contains about 9000 lines of code. After nearly ten years of intermittent development on multiple versions, a couple of which were rewrites that completely reorganized it but didn't change its function at all!, the program is almost exactly what I'd always wanted it to be, but still in skeletal form. It is a collection of proofs of concept, some of which show considerable promise. It was at this point where it had become "almost exactly what I'd always wanted it to be" that I learned that Borland had dropped OWL from its product line. Instead of the refinements, development, and experimentation that I'd planned, it now needs a complete rewrite to a new modern language, which is almost more than I can contemplate. If you are interested in "chatterbots" in general, the Wikipedia Chatterbot article looks like a good place to start exploring. It has many links that look interesting. The components of WTalk that are on web pages are listed here and shown in the link bars on this page. On any of those pages, click the "Up" button to return to this page.
Download:Click here to download wtalk.zip (about 500 KB). The zip contains the files that are unique to this project, shown in the table below. In addition, the WTalk project uses most of the C++ library functions and classes on this website. On each of the web pages in the table above, you will find links to the needed files at the locations where they are referenced.
There are possibly a hundred pages of handwritten project notes and diagrams that must be transferred onto the computer before they can be incorporated into this project. From time to time, whatever of those notes have been processed will be added here as web pages, added to the zip, or both. |
|
1) This is the program's main window in which the dialog with the user takes place. The results of the program's last parsing attempt is shown in the edit control on the right, along with information about the rules that were triggered by the input.

2) This is the dialog box in which the user can manually create a response rule for the program to use.

3) This shows the project nodes for the full Windows OWL version of the project in the Borland C++ 4.0 (Windows 3.1) IDE. It might help you decide how to set up the nodes in your C++ compiler, IDE, or project manager.

|
|
|
|
|
|