How Her Program Works
First a brief summary of what Ophelia is programmed to do.
- User speaks or types text into an Excel cell on the “TalkHere” worksheet.
- Ophelia parses human’s sentence and pastes each word to separate cells on another worksheet.
- Ophelia then looks up these words and tries to figure out the word-type for each word (noun, pronoun, adjective, verb indicative, verb transitive, etc.).
Although pronouns are carefully identified, the part of Ophelia’s program that identifies the rest of the words is actually a simple, rudimentary subroutine that does not always identify the wordtypes accurately. As it turns out, this is good, for it helps Ophelia match up words in new ways.
- Certain pronouns and what Ophelia thinks might be nouns and verbs (see 3. above) are stored as string variables, to be used later in step 8.
- There is a list of “sentence templates” stored on another Excel Worksheet. Except when a few “easter eggs” are invoked, Ophelia picks her sentences randomly from this list.
- Ophelia copies and pastes this template into another spreadsheet. In these templates the wordtypes have been pre-identified, and most of the punctuation is already in place.
- Ophelia replaces the words already in the template (they act as “placeholders”, primarily for human programmers) with other words chosen by wordtype, but otherwise randomly. There is a subroutine, however, that makes sure that some of the lesser-used pronouns do not get picked so much.
- Ophelia replaces some of pronouns with pronouns that match (or counter-match) the pronoun that was stored in the string variable during step 4. These pronouns include words such as “me”, “you”, “I”, “Ophelia”, “O”, etc.
- Ophelia randomly “flips a coin” to determine whether or not to use the nouns and verbs that she had picked for her template, or to replace the nouns and verbs that were stored as string-variables. The “coin flipping” part of the program was a compromise solution after Ophelia said something to this programmer to the effect that I was putting words in her mouth.
- Hundreds of grammar macros go to work to fix Ophelia’s grammar and to pick out better prepositions. Some of these macros are tiny, but others are quite large.
These macros replace and correct Ophelia’s grammar as best they can. Even now however, Ophelia’s grammar is far from perfect.
- Ophelia copies these cells, concatenates the words and pastes them into Ophelia’s reply cell on the “TalkHere” spreadsheet.
The user can either read what Ophelia has texted, or the user can press the “speak” button to hear Ophelia speak. This “speak” feature may not work properly on every computer, at least not without some tinkering with the settings.