An example of language parsingJuly 14, 2008
Before we get too generic about how to parse language, let's start with a simple problem: How to parse the statement
"My name is Daniel" and update our data structure to reflect this statement.
Defining inputs and outputsOur input is a list of words:
| "My", "name", "is", "Daniel" |
|
Our desired output is a value assignment that will modify our data structure:
| speaker.first_name = "Daniel" |
|
... where
speaker is a new entity in the data structure to represent the person we're conversing with.
TransformationsWe can achieve our goal by applying a series of transformations to the list of words. For instance:
What this says is that if the word "my" is followed by a noun, that could be referring to
speaker.noun. In our example:
However, we have a bit of an issue since we want
speaker.first_name. What this highlights is that "name" is still a word; it hasn't been mapped to an entity in the data structure yet. What we need is a mapping from words to entities. In our example, we want:
Thus, when a transformation such as "my {noun} -> speaker.$1" is applied, a second step will be resolving the noun to its possible entities.
What we have now is an intermediate representation, such as:
| [speaker.first_name] is Daniel |
|
The first part,
speaker.first_name, is fully transformed, but the rest of the statement is still a list of words. The next transformation we need is:
| {noun} is {word} -> $1 = $2 |
|
What this says is that if the word "is" gets placed between a noun and a word, that could mean that the word defines the value of the noun. In our example, the word "Daniel" defines the value of "My name":
| [speaker.first_name] is Daniel -> speaker.first_name = "Daniel" |
|
The need for languageJuly 14, 2008
Developing a data structure for an AI's knowledge about the world is the first step, but until it is connected to the real world via a "language in" layer, it can't do very much. People need to be able to interact with it.
The basic setup that is required is to have a language layer that parses simple English statements and then updates the AI's data structure to reflect what was said. What makes this interesting is that, inevitably, the data structure is also involved in the process of language parsing.
A more advanced language layer also allows simple questions to be asked, completing the loop, so that a human participant can make a statement and then ask a question to test whether the AI understood the statement.
For example:
Statement: "My name is Daniel"
Data structure representation:
speaker.first_name = "Daniel"Question: "What is my name?"
Answer: "Daniel"
Summary: Entities, relationships, is_a, has, and assignmentJuly 10, 2008
The framework we've laid out so far will allow us to model quite a bit about the world. For example, we can model the following:
  | Daniel is_a man |
  | man is_a person |
  | person has_a age |
  | Daniel.age = 27 |
  | person has_a first_name |
  | Daniel.first_name = "Daniel" |
  | person has_a last_name |
  | Daniel.last_name = "Bigham" |
  | 0.4: man has:0 wife |
  | 0.6: man has:1 wife |
  | Daniel has:1 wife |
  | wife is_a woman |
  | woman is_a person |
  | Meredith is_a wife |
  | Daniel.wife = Meredith |
  | Meredith.first_name = "Meredith" |
  | Meredith.last_name = "Bigham" |
  | 0.4: person has:0 sister |
  | 0.6: person has:(>:0) sister |
  | Daniel has:2 sister |
  | sister is_a woman |
  | Rebekah is_a sister |
  | Hannah is_a sister |
  | Daniel.sister[0] = Rebekah |
  | Daniel.sister[1] = Hannah |
  | Rebekah.first_name = "Rebekah" |
  | Rebekah.last_name = "de Bueger" |
  | Hannah.first_name = "Hannah" |
  | Hannah.last_name = "Bigham" |
older >>