Ophelia:
How Her Program Works

 First a brief summary of what Ophelia is programmed to do.

  1.  User speaks or types text into an Excel cell on the “TalkHere” worksheet.
  2.  Ophelia parses human’s sentence and pastes each word to separate cells on another worksheet.
  1.  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.

  1.  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.
  2.  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.
  3.  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.
  4.  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.
  5.  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.
  6.  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.
  7. 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.

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