Post on 30-Dec-2015
description
2
Natural Language Processing There are three basic types of processing going on
during human/computer voice interaction: Voice recognition — recognizing human words Voice synthesis — recreating human speech Natural language comprehension — interpreting human
communication Recognition and Synthesis both present their own
special problems, but it’s Comprehension that seems the most difficult.
3
Natural Language Comprehension Even if a computer recognizes the presence of
a voice, and can identify the words that are spoken, it is another task entirely to understand the meaning of those words. Natural language is inherently ambiguous,
meaning that the same syntactic structure could have multiple valid interpretations.
4
Syntactical Analysis
Syntax is the study of the rules whereby words or other elements of sentence structure are combined to form grammatical sentences.
A syntactical analysis identifies the various parts of speech in which a word can serve, and which combinations of these can be assembled into sensible sentences.
5
Syntactical AnalysisConsider an example:
Time flies like an arrow.To determine what it means we first parse the
sentence into its parts of speech.
Notice that a single word can be used as several parts of speech.
6
Syntactical Analysis‘time’ can be used as a noun, a verb, or an adjective.
‘flies’ can be used as a noun, or a verb.
‘like’ can be used as a noun, a verb, a preposition, an adjective, or an adverb.
‘an’ can be used only as an indefinite article.
‘arrow’ can be used as a noun, or a verb.
7
Syntactical AnalysisThe table below summarises the various possibilities.
The a priori total number of syntactical interpretations is:
3 * 2 * 5 * 1 * 2 = 60
adjective adverb article noun preposition verb
time
flies
like
an
arrow
8
Syntactical AnalysisThis number can be reduced by applying syntactical rules. For
example, articles are used to “indicate nouns and to specify their application”. Since ‘an’ is an article, ‘arrow’ must be a noun, not a verb.
This cuts the number of possible sentences in half – to 30!
adjective adverb article noun preposition verb
time
flies
like
an
arrow
possible role current role excluded role
9
Syntactical AnalysisLet’s build a list of reasonable possibilities.
Consider the ways in which ‘time’ can be used:
Adjective Verb (intr) Noun
10
Syntactical Analysis - ‘time’ as an adjective
An adjective is “the part of speech that modifies a noun”
So when ‘time’ is an adjective, ‘flies’ must be a noun.
A sentence needs a verb, so if ‘flies’ is a noun, ‘like’ must be the verb.
If ‘time’ is an adjective there is only ONE syntactical interpretation.
11
Syntactical Analysis - ‘time’ as an adjective
adjective adverb article nounprepositio
nverb
time
flies
like
an
arrow
current role excluded role
12
Syntactical Analysis - ‘time’ as an adjective
A syntactical analysis provides a structure.
A semantic analysis is needed for meaning.
What would the sentence mean under this syntactical interpretation?
13
Semantic Analysis - ‘time’ as an adjective
‘time’ adjective“of, relating to, or measuring time”
‘flies’ noun“two-winged insect”
‘like’ verb“find pleasant or attractive”
‘an’ article
‘arrow’ noun“missile having a straight thin shaft with a pointed head at one end and often flight-stabilizing vanes at the other”
time flies (not house flies)
enjoy
an arrow(watching it, chasing it, eating it)
14
Semantic Analysis - ‘time’ as an adjective
‘time’ adjective“of, relating to, or measuring time”
‘flies’ noun“two-winged insect”
‘like’ verb“find pleasant or attractive”
‘an’ article
‘arrow’ noun“missile having a straight thin shaft with a pointed head at one end and often flight-stabilizing vanes at the other”
time flies (not house flies)
enjoy
an arrow(watching it, chasing it, eating it)
15
Semantic Analysis - ‘time’ as an adjective
‘time’ adjective“of, relating to, or measuring time”
‘flies’ noun“two-winged insect”
‘like’ verb“find pleasant or attractive”
‘an’ article
‘arrow’ noun“missile having a straight thin shaft with a pointed head at one end and often flight-stabilizing vanes at the other”
time flies (not house flies)
enjoy
an arrow(watching it, chasing it, eating it)
16
Semantic Analysis - ‘time’ as an adjective
‘time’ adjective“of, relating to, or measuring time”
‘flies’ noun“two-winged insect”
‘like’ verb“find pleasant or attractive”
‘an’ article
‘arrow’ noun“missile having a straight thin shaft with a pointed head at one end and often flight-stabilizing vanes at the other”
time flies (not house flies)
enjoy
an arrow(watching it, chasing it, eating it)
17
Semantic Analysis - ‘time’ as an adjective
‘time’ adjective“of, relating to, or measuring time”
‘flies’ noun“two-winged insect”
‘like’ verb“find pleasant or attractive”
‘an’ article
‘arrow’ noun“missile having a straight thin shaft with a pointed head at one end and often flight-stabilizing vanes at the other”
time flies (not house flies)
enjoy
an arrow
(watching it, chasing it, eating it?)
18
Lexical AmbiguityThis interpretation sounds absurd to us, but as our
analysis showed, it’s a perfectly logical.
This is the problem of lexical ambiguity.
It arises because words have multiple syntactical and semantic associations.
In this sentence there are many syntactically and semantically valid interpretations of the words.
19
Syntactical Analysis - ‘time’ as a verb
When ‘time’ is the verb, ‘flies’ can only be a noun serving as the object of the verb.
The only available role for the rest of the sentence is as an adverbial phrase with like as its preposition.
adjective adverb article noun preposition verb
time
flies
like
an
arrow
20
Semantic Analysis - ‘time’ as a verb
Having identified a single well-formed sentence in which ‘time’ is the verb, we must now analyse it under the 5 semantic interpretations of ‘time’ as a verb.
One of these is: 4. To record the speed or duration of: time a runner.
‘flies’ is a noun. We’ve seen one meaning, here’s another of the 12 listed in The Free Dictionary :
5. Baseball A fly ball.
21
Semantic Analysis - ‘time’ as a verb
So, another interpretation of our example says that when you measure the length of time it takes a fly ball to travel its route, use the same techniques that you use when you time an arrow.
This interpretation isn’t as odd as it might seem.
We know that the paths taken by fly balls and arrows are all parabolic arcs, so it makes sense to time them the same way.
22
Syntactical Analysis - ‘time’ as a nounEvery sentence needs a verb, but there can only be one.
When the verb is ‘like’ there’s only one set of roles for the other words.
Notice that the occurrence of two nouns together violates another syntax rule so this is NOT a possible interpretation.
adjective adverb article noun preposition verb
time
flies
like
an
arrow
23
Syntactical Analysis - ‘time’ as a nounWhen the verb is ‘flies’ there are 4 roles ‘like’ could play.
However, not all parts of speech are ‘legal’ following a verb.
adjective adverb article noun preposition verb
time
flies
like
an
arrow
24
Syntactical Analysis - ‘time’ as a noun
Remember that ‘flies’ is an intransitive verb, so it has no object.
The constructions that can follow it are limited to adverbs and adverbial phrases.
In this case, “like an arrow” must be an adverbial phrase with like as its preposition
25
Semantic Analysis - ‘time’ as a noun
The Free Dictionary lists 29 distinct meanings for the noun ‘time’. Consider the first one:
1. a. A nonspatial continuum in which events occur in apparently irreversible succession from the past through the present to the future.
This is a normal sense of what we mean by ‘time’ but which meaning of the verb ‘flies’ should be used?
26
Semantic Analysis - ‘time’ as a noun
The Free Dictionary lists only one definition:“Third person singular present tense of fly.”
The verb ‘fly’ has 14 different meanings!
The most commonly used of these is “To engage in flight.” But can that be the meaning intended in our saying?
How does a computer program decide?
It’s easy to see why NLC is difficult for computers.
27
Natural Language Comprehension A natural language sentence can also have a
syntactic ambiguity because phrases can be put together in various ways.
I saw the Grand Canyon flying to New York.
28
Natural Language Comprehension A natural language sentence can also have a
syntactic ambiguity because phrases can be put together in various ways.
I saw the Grand Canyon flying to New York.
Is it possible that the Grand Canyon flew to New York?
29
Natural Language Comprehension Referential ambiguity can occur with the use of
pronouns.
The brick fell on the computer but it is not broken.
30
Natural Language Comprehension Referential ambiguity can occur with the use of
pronouns.
The brick fell on the computer but it is not broken.
Since ‘it’ is the subject of the second clause, its referent is the subject of the first clause – ‘the brick’!
Are you happy knowing that no harm came to the brick?