Documente Academic
Documente Profesional
Documente Cultură
Understanding nature language is a mundane task. Mundane tasks Humans can do easily but very difficult to automate by computers. Natural Language Processing (NLP): 1. Natural Language Understanding 2. Natural Language Generation
Spoken/typed sentence
Formal representations
English expressions
Speech Recognition
Syntactic Analysis
Sentence structure
Understanding spoken language is much harder as the input is just the raw speech signals taken from a microphone.
159.302, Isaac Fung, IIST, 2005
3
Speech Recognition
He
loves
Pragmatics
Semantic Analysis
Syntactic Analysis
To understand how words are grouped together to make complex sentences. A starting point for working out the meaning of the whole sentence. Consider the following two sentences: 1. The dog ate the bone. 2. The bone was eaten by the dog.
Syntactic Analysis
Understanding the structure (via the syntax rules) of the sentences help us work out that its the bone that gets eaten and not the dog. Simple rule such as its the 2nd noun that gets eaten wouldnt work. Syntactic analysis determines possible groupings of words in a sentence.
Syntactic Analysis
Consider the following sentence: The rabbit with long ears enjoyed a large green lettuce. Noun phrase Noun phrase
Syntactic Analysis
In other cases there may be many possible groupings of words. Consider the sentence John saw Mary with a telescope. Two different readings based on the groupings:
1. 2.
John saw (Mary with a telescope). John (saw Mary with a telescope).
Syntactic Analysis
The use of general knowledge can sometimes help working out which is the intended grouping. For example, consider the sentence I saw the bridge flying into Auckland This sentence is unambiguous if we bring to bear general knowledge about bridge.
Syntactic Analysis
Syntactic analysis helps determining the meaning of a sentence by working out possible word structures. Rules of syntax are specified by writing a grammar for the language. A parser 1. will check if a sentence is correct according to the grammar. 2. returns a representation of the sentences structure. Parse tree
10
Syntactic Analysis
A grammar specifies allowable sentence structures in terms of basic categories such as nouns and verbs. A given grammar, however, is unlikely to cover all possible grammatical sentences. Parsing sentences is to help determining their meanings, not just to check that they are correct. A good starting point is a simple context free grammar.
Syntactic Analysis
Suppose we want a grammar that recognises sentences like the following: 1. John ate the biscuit. 2. The lion ate the zebra. 3. The lion kissed John. but reject incorrect sentences such as: 1. Ate John biscuit the. 2. Zebra the lion the ate. 3. Biscuit lion kissed.
11
12
Syntactic Analysis
A simple grammar that deals with this is given below:
sentence --> noun_phase, verb phrase. noun_phrase --> proper_noun. noun_phrase --> determiner, noun. verb_phrase --> verb, noun_phrase. proper_noun --> [mary]. proper_noun --> [john]. noun --> [zebra]. noun --> [biscuit]. verb --> [ate]. verb --> [kissed]. determiner --> [the].
159.302, Isaac Fung, IIST, 2005
13
Syntactic Analysis
The grammar rule John ate the biscuit
sentence --> noun_phase, verb_phrase. says that a sentence consists of a noun phrase and a verb phrase. Subject the thing that does something Predicate the thing that was done
14
Syntactic Analysis
A simple grammar:
sentence --> noun_phase, verb phrase. noun_phrase --> proper_noun. or noun_phrase --> determiner, noun. verb_phrase --> verb, noun_phrase.
Syntactic Analysis
John ate the biscuit.
np vp
v det
np n
and Incorrect sentences such as biscuit lion kissed will be excluded by the grammar. However, some odd sentences are still allowed such as The biscuit kissed John.
159.302, Isaac Fung, IIST, 2005
proper_noun --> [mary]. proper_noun --> [john]. noun --> [zebra]. noun --> [biscuit]. verb --> [ate]. verb --> [kissed]. determiner --> [the].
159.302, Isaac Fung, IIST, 2005
15
16
Syntactic Analysis
A parse trees illustrates the syntactic structure of the sentence.
sentence noun_phrase proper_noun verb verb_phrase noun_phrase determiner noun
Syntactic Analysis
The grammar given above is very limited. It either 1. fails to handle complex sentences; or 2. recognize some sentences that are ungrammatical such as
Subject verb agreement
John
ate
the
lion
18
Semantic Analysis
The stages of semantic and pragmatic analysis are concerned with getting the meaning of a sentence. Semantics a partial representation of the meaning is obtained based on the possible syntactic structure(s) of the sentence, and on the meanings of the words. Pragmatics the meaning is elaborated based on contextual and world knowledge.
Semantic Analysis
Compositional Semantics - the meaning of the whole sentence can be put together from the meaning of the parts of the sentence. The division of the sentence into meaningful parts was done by syntactic analysis. In general the meaning of a sentence may be represented using any of the knowledge representation schemes.
19
20
Semantic Analysis
Using predicate logic, for example, one can represent sentences like John likes Mary The man likes Mary A man likes Mary likes(john,mary) man(m1)likes(m1,mary) X(man(X)likes(X,mary))
Semantic Analysis
Using semantic net, one can represent sentence Tarzan kissed Jane as
person: tarzan person: jane
agent
kiss
object
past
tense
instrument
lips
21
22
Pragmatics
John likes Mary Speech recognition // sound Syntactic analysis // structure Semantic analysis // meaning likes(john,mary) Context of the utterance where it was said, by whom and why, and what was said before.
159.302, Isaac Fung, IIST, 2005
23
25
26
27
28
29
30
32
The first is with Air New Zealand, costs $180, and leaves at 11am.
33
34
Readings
Textbook: Section 13.0 13.3 & 13.5 Supplementary notes.
35