class notes of nlp--5

Upload: rajgupta

Post on 03-Jun-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Class Notes of NLP--5

    1/79

    The main goal of NLP is to build computational models of natural language

    for its analysis and generation. In particular this work is interdisciplinary field called computational linguistics

    driven from researches in AI .There are two primary motivations for this type of research.

    First the technological motivation is to build intelligent computer systems.

    !econd the linguistic and cognitive science motivation is to gain a better

    understanding of how humans communicate by using natural language.

    The tools of work in NLP are grammar formalisms, algorithms and data structures,

    formalism for representing world knowledge, reasoning mechanism, etc.

    These have been taken from computer science AI linguistics logics and philosophy.

    Theoretical linguists are primarily interested in producing a structural description of

    natural language. They do not consider the details of the way that actual sentences mightbe generated from structural descriptions. The ma"or constraint of linguists is to

    characteri#e the general organi#ing principles that underline all human language.

    Goal:The goal of theoretical linguists is a formal specification of linguistic structure

    both in the form of constructive rules that define the range of possible structures and in

    the form of constraints on the possible allowable structures.

    Applications of NLP:$. Natural Language Interface to databases.

    %. Natural Language Interface to computers. &'(ample)* to assist a new user to

    +NI, -! developed at erkeley/.

    0. 1uestion answering systems. &'(ample)* 'LI2A*L+NA3 by woods in $445/.

    6. 7achine Translation !ystem.

    8. Te(t analysis systems.

    9. !peech understanding systems and generating systems.

    5. :omputer aided Instruction system &'(ample)* :AL and etc./

    Knowledge and Language:

    A language comprehension program must have considerable knowledge about thestructure of the language itself including

    -;hat the words are

    * aiswal

  • 8/12/2019 Class Notes of NLP--5

    2/79

    * ;hat the words mean

    *

  • 8/12/2019 Class Notes of NLP--5

    3/79

    * The books are where you left them.

    6. )er*: Averbis a word used to say something about some person place orthing.

    * The girl wrote a letter to her cousin.

    * :alcutta is a big town.* Iron and copper are useful metals.

    8. Ad(er*: An adverb is a word used to add something to the meaning of a verb an

    ad"ective or another adverb.

    *

  • 8/12/2019 Class Notes of NLP--5

    4/79

  • 8/12/2019 Class Notes of NLP--5

    5/79

    /"ample: The sun rises in the east.

    !ub"ect Predicate

    The sub"ect of the sentence usually comes first but sometimes it is put after

    the predicate such as

    * =own went the 3oyal Deorge.* !weet are the uses of adversity.

    In imperative sentences the sub"ect is left out such as

    * !it down) &ou is understood/

    * Thank him. &ou is understood/

    The Phrase) A group of words which makes some sense but not complete sense is called

    phrase.

    '(ample) * The sun rises in the east.

    * There came a giant to my door.

    * It was a russet of great beauty.

    *

  • 8/12/2019 Class Notes of NLP--5

    6/79

    0. &eterminers:These words includea/ Article a an the.

    b/ &emonstrati(es This that these those.

    c/ Possessi(es my his own 3amGs etc.

    6. 1rdinals: words like) * first third second last ne(t etc.

    8. uantifiers:words like ? many several few less etc.

    9. Ad'ecti(e Phrase: good long fall etc. intensifier and ad"ective such as

    * Hery good very fall etc.

    5. +lassifiers: - A city college

    * A leather purse

    * A summer dress

    2is last pla$ A (er$ nice shirt

    #u*'ect #u*'ect

    det. ord. Noun

    det. Ad'. Phrase noun

    poss.

    Art nt Ad'.

    2is Last Pla$

    a (er$ nice shirt

    All the famous (ictories 2er old leather shoes

    #u*'ect #u*'ect

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    7/79

    Pre.det det. Ad'. Noun det. Ad'. +lass Noun

    Prepositional Phrase:

    Prepositional Phrase

    Preposition Noun Phrase

    /(ample) The *o$ on the *ridge

    #u*'ect

    NP Prep. Phrase

    &et. Noun Prep. NP

    Art det. Noun

    The *o$ on the *ridge

    Predicate: This is also called verbal group or verbal phrase.

    This verbal group may be followed by NP adverb and so on. This may be defined as

    )G

    Au(iliary 7ain verb

    Au(iliary in turn is made up of the tense &compulsory item/ and any one or more of thefollowing items)

    i. !odal: marked by modal au(iliaries such as can may will shall must etc.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    8/79

    ii. Perfecti(e: marked by have 3 en@ where en is a marker of the past participle

    morpheme.

    iii. Progressi(e:marked by be ing.

    )G

    Au". )er*

    Tense 7odal Perfective Progressive

    4asic sentence patterns)

    A basic sentence &or a kernel sentence/ is the simplest form ofsentence which is simple &not comple( or compound/ declarative and affirmative and is

    in the active voice.

    !uch sentences can be broadly classified into five different patterns)

    * Two of these patterns are intransitive.&+sing such verbs as do not take ob"ect/.

    * Three of these patterns are transitive.

    ntransiti(e Predicate Phrase Patterns:

    Pattern-: Herbal group only or verbal group Ad"unct.

    Ad'unct: An ad"unct is a part of the sentence that can be taken out without breakingthe structure of the sentence.

    '(amples)

    $. 3amesh died yesterday at Ludhiana.

    Nuclear Ad"unct

    Part%. I saw him in the theatre.

    Nuclear Ad"unct

    0.

  • 8/12/2019 Class Notes of NLP--5

    9/79

    !ub. HD

    %. The car turned into a narrow lane.

    !ub. HD Ad"unct

    0. They will write about it to the governer.

    !ub. HD Ad"unct Ad"unct

    Pattern-)Herbal Droup :omplement &Ad"unct/

    The complement may be a noun phrase an adverbal prepositional phrase or

    an ad"ective phrase.

    i. 3ita was a damned witch.

    !ub. HD :omplement&NP/

    ii. 3ita was in a fi(.

    !ub. HD Prep. Phrase

    iii. 3ita is beautiful.

    !ub. HD Ad"ective

    iv. 3ita is there.

    !ub. HD Adverbia

    v.

  • 8/12/2019 Class Notes of NLP--5

    10/79

    5. 4e-t$pe :6 is, am, are, was, were, *e, *een, *eing7

    This can take all four categories as complements.

    '(amples)

    *

  • 8/12/2019 Class Notes of NLP--5

    11/79

    NP

    0. #mell-t$pe:This can take only ad"ective phrase.

    * The pudding tastes delicious.

    Ad".Phrase* The soup smells horrible.

    Ad". Phrase

    * The king felt helpless.

    Ad". Phrase

    6.2a(e-t$pe: This can take only noun phrase as complements.

    *

  • 8/12/2019 Class Notes of NLP--5

    12/79

    * 'verybody knows her style.

    !ub. HD -b".

    * ou should do your duty.

    !ub. HD -b".

    * aiswal

  • 8/12/2019 Class Notes of NLP--5

    13/79

    Pattern ): Herbal Droup -b"ect :omplement &Ad"unct/

    -b"ective !ub"ective

    :omplement :omplement

    A complement may be

    NP

    Ad". Phrase

    An adverbial

    A prepositional phrase

    *

  • 8/12/2019 Class Notes of NLP--5

    14/79

    ;e have two meanings)*

    * The magician made a steam*engine for him.

    The magician made him a stream*engine.

    -b". -b".:omp.

    * The magician changes him into a steam*engine by magic.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    15/79

    mmediate +onstituent Anal$sis 8or + Anal$sis9

    In order to study the structure of a sentence the structure linguists thought ofdividing a sentence into its immediate constituents &or I:s/. The principles was that of

    cutting a sentence into two further cutting these two parts into another two and continue

    the segmentation till the smallest unit.

    '(ample)

    A young girl with an umbrella chased the boy.

    $ % $ and % are called constituents.

    Further A young girl with an umbrella chased the boy.

    $A $ %A %

    A young with an chase KPast the boy girl umbrella

    young girl an umbrella

    !egmentation using a tree diagram

    #entence

    !ub. Predicate

    NP Pre.Phrase HD NP

    =et. Ad". N Pre. NP Tense H det. Noun

    A young girl with det. N Past chase the boy

    Art.

    An umbrella

    This type of analysis of a sentence is called Immediate Constituent Analysis (ICAnalysis).

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    16/79

    Perform + anal$sis of the following sentences:

    * Kapil has *een pla$ing cricket for se(eral $ears.

    * After depositing the fees the *o$s went to the hotel.

    * The girls ha(e *een singing nicel$.

    Limitations:

    There are some sentences whose I: analysis is not possible as they do not

    form proper grammatical group.

    '(ample) *

    * !he is taller than her sister.

    This is not covered in I: analysis.

    * Time flies.

    This has two meanings)

    Time is flying.

    Time the flies. &Time as verb/

    * >ohn is easy to flatter.

    * >ohn is eager to flatter.

    !eparate analysis is reuired)

    * It is easy. !omeone flatters >ohn.

    * >ohn is eager. aiswal

  • 8/12/2019 Class Notes of NLP--5

    17/79

    #tructures:5. !ub"ect Herb

    * irds fly.* Fire burns.

    * The baby is crying.

    * The bell has rung.

    M

    . !ub"ect Herb !ub :omplement.

    * This is a pen.

    * Dopal looks sad.

    * 7y father grew angry.

    M

    ;. !ub"ect Herb direct ob"ect.

    * I know his address.

    * The boy has lost his pen.

    * ;e should help the poor.

    M

    . !ub"ect Herb NounPronoun ad"ective.

    * The boy pushed the door open.

    * The smith beat it flat.

    * !he washed the plates clean.

    M

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    18/79

    ?. !ub"ect Herb preposition Prepositional ob"ect.

    * ;e are waiting for !uresh.

    *

  • 8/12/2019 Class Notes of NLP--5

    19/79

    5

  • 8/12/2019 Class Notes of NLP--5

    20/79

    ontext Free Grammars

    Let us consider the following :FD)

    # NP )P

    )P )/04 NP

    NP NA!/

    NP A0T N1CN

    In this ! NP HP are called non terminal symbols and N-+N A3T H'3 are

    terminals.

    The terminal symbols are word categories and a structure called le(icon

    maintains a list of all words that fall in each category. A word may be listed undermultiple categories.

    or e"ample* canwould be listed under H'3 and N-+N.

    There are two simple parsing techniues for :FDs such as Topdo!nand"ottomup

    parsing.

    Top*down parsing begins with ! and rewriting it) * such as NP HP. These symbols

    may themselves be written as per the rewrite rules. Finally terminal symbols such as

    N-+N may be written from le(icon.

    '(ample) >ohn ate an apple.

    Parse tree

    #

    NP HP

    NA7' H'3 NP

    >ohn ate A3T N-+N

    an apple

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    21/79

    Possible Top*=own parsing would be as follows)

    !NP HP

    NA7' HP Orewriting NP >ohn HP Orewriting NA7'

    >ohn H'3 NP Orewriting HP

    >ohn ate NP Orewriting H'3

    >ohn ate A3T N-+N Orewriting NP

    >ohn ate an N-+N Orewriting A3T

    >ohn ate an apple Orewriting N-+N

    A possible bottom*up parsing of the sentence would be as follows)

    >ohn ate an apple.

    NA7' ate an apple. Orewriting >ohn

    NA7' H'3 an apple. Orewriting ate

    NA7' H'3 A3T apple. Orewriting an

    NA7' H'3 A3T N-+N Orewriting apple

    NP H'3 A3T N-+N Orewriting NA7'

    NP H'3 NP Orewriting Art Noun

    NP HP Orewriting Herb NP

    ! Orewriting NP HP

    Now consider the following :FD)

    ! NP HP

    NPA3T N-+N

    NPNA7'

    HPH'3

    HPH'3 NP

    HP

    H'3 NP PPHPH'3 PP

    PPP3'P NP

    For simple class of declarative 'nglish sentences)

    :onsider the following sentences)

    * >ohn saw the cat by the pond.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    22/79

    * The dog barked in the house.

    Find possible parsing of these sentences.

    The above grammar will also accept the following sentences)

    *The dog allows the house. *>ohn barked the cat by the pond.

    This is because the grammar does not encode any information as to what verbsmay take ob"ects and what prepositions are appropriate for each verb.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    23/79

    #imple Transition Network

    This is another grammar representation. This formalism is based on the notion of atransition network consisting of nodes and labeled arcs.

    :onsider the following network named NP)

    NP)

    art noun pop

    Ad"

    'ach arc is labeled with a word category.

    !tarting at a given node you can traverse an arc if the current word in the sentence

    is in the category on the arc. If the arc is followed the current word is updated to the ne(tword.

    A phrase is legal NP if there is a path from node NP to a pop arc &an arc labeledpop/ accounting for every word in the phrase. This network recogni#es the same set of

    sentences as the following :FD)

    NPA3T NP$

    NP$A=> NP$

    NP$N-+N

    :onsider the parsing of the noun phrase a purple cow with preceding network.

    !tarting at node NP you can follow the arc labeled art since current word is an

    article named a.

    From node NP$ you can follow the arc labeled ad" using ad"ectivepurple#

    and finally again from NP$ you can follow the arc labeled noun using noun cow.

    since we have reached a pop arc a purple co! is a legal noun phrase.

    !imple transition network formalism is not powerful enough to describe all

    languages that can be described by :FD. To get the descriptive power of :FDs there is

    reuirement of recursion in network grammar.

    =eveloped by =r +mesh :handra >aiswal

    NPNP$

    NP

    %

  • 8/12/2019 Class Notes of NLP--5

    24/79

    A recursive transition network &3TN/ is like simple transition network e(cept that

    it allows arc labels that refer to other networks rather than word categories.

    A recursive network for simple 'nglish sentences can be e(pressed as shownbelow)

    NP verb NP pop

    !)

    Cppercase la*els refer to network

    The arc from ! to !$ can be followed only if the NP network can be successfully

    traversed to a pop arc. 3TN allows true recursion i.e. a network might have an arc labeledwith its own name.

    Let us see arc labels for 3TNs)

    Arc T$pe /"ample 2ow used

    :AT noun !ucceeds only if the current

    word of the named category

    ;3= of !ucceeds only if the current

    word is identical to the label

    P+!< NP !ucceeds only if the namednetwork can successfully

    traversed

    >+7P "ump Always succeeds

    P-P pop !ucceeds and signals the

    end of the network

    Now consider finding a path through the ! network for the

    following sentence)

    The purple cow ate the grass.

    First from ! to NP now there is a need to traverse NP network.

    Following arc pop return to ! network and traverse the arc to node !$ from node !$

    follow the arc labeled verb using the word ate.

    =eveloped by =r +mesh :handra >aiswal

    !

    !

    $

    !

    %

    !

    0

  • 8/12/2019 Class Notes of NLP--5

    25/79

    Finally arc labeled NP can be followed if NP network is traversed again. Now

    remaining input consist of words the grass.

    Now take the pop arc from NP% and another pop from node !0.

    !ince the network is traversed and used all the words in the sentence. aiswal

    !!

    $

    !

    %

    !$

    !%

    !8

    !6!0

  • 8/12/2019 Class Notes of NLP--5

    26/79

    Top &own Parsing with 0TN:

    The state of the parse at any moment can be represented by the following)

    +urrent Position - record of what part of sentence has not yet been parsed

    +urrent Node - the node at which you are located in the network

    0eturn Point - if you are in a network because of a call from another network you

    need to record the node in the other network where you will continue

    if you pop from the current network.

    If 3TN contains only cat push and pop arcs then this algorithm converts to a full

    search for the entire set of arcs using a techniue called backtracking.

    :onsider a situation where you are in the middle of a parse try to follow an arcleaving the current node that can be traversed successfully as one of the cases in the

    following algorithm.

    ig-

    Art noun pop

    NP) $ $ % % $ Number

    %

    $ ad"

    0

    pronoun

    !) NP verb pop

    %

    $ NP

    The numbers on the arcs simply indicate the order in which arcs will be tried when more

    than one arc leaves a node.

    =eveloped by =r +mesh :handra >aiswal

    NPNP

    $

    NP

    %

    ! !$ !%

  • 8/12/2019 Class Notes of NLP--5

    27/79

  • 8/12/2019 Class Notes of NLP--5

    28/79

    #tep +urrent #tate Arc ollowed 4ackup #tates

    $. &! $ NIL/ !$ NIL%. &NP $ &!$// NP$&Q NP0 NIL

    for backup/

    0. &NP$ % &!$// NP$% &NP% % &!$//6. &NP% 0 &!$// NP%$ &NP% % &!$//

    8. &!$ 0 NIL/ no arc can be &NP% % &!$//

    Followed9. &NP% % &!$// NP%$ NIL

    5. &!$ % NIL/ !$$ NIL

    B. &!% 0 NIL/ !%% NIL

    4. &NP 0 &!%// NP$ NIL$R. &NP$ 6 &!%// NP$% NIL

    $$. &NP% 8 &!%// NP%$ NIL

    $%. &!% 8 NIL/ !%$ NIL

    $0. The parse succeeds.

    :urrent parse state&:urrent node :urrent position return points/

    Parsing is a special case of search.

    =F! F!

    +onsider the following sentence:

    $The %wild 0dogs 6cried.8

    A trace of a top-down parse using 0TN of ig. .

    #tep +urrent

    Node

    +urrent

    position

    0eturn

    Points

    Arc

    ollowed

    +omments

    $. &! $ NIL/ !$ Initial position

    %. &NP $ &!$// NP$ Followed push arc to

    NP network to return to!$

    0. &NP$ % &!$// NP$$ followed arc$

    6. &NP$ 0 &!$// NP$% followed arc6 to NP$

    again

    8. &NP% 6 &!$// NP%% followed arc8 since arc6

    was not applicable

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    29/79

    9. &!$ 6 NIL/ !$$ the pop gets in back to !$

    5. &!% 8 NIL/ !%$ followed arc5

    B. parse succeeds on pop arcfrom !%

    +onsider the sentence:

    The green faded.

    It would fail because it will classify green as ad" and then not be

    able to find a noun.

    +onsider the following +G:

    $. !NPHP 8. HPH'3

    %. NPA3T N-+N 9. HPH'3 NP

    0. NPNA7' 5. HPH'3 NP PP

    6. PPP3'P NP B. HPH'3 PP

    Now !entence) $The %dogs 0cried.6

    Top*down depth first parse for the :FD

    #tep +urrent

    #tate

    4ackup #tates Position +omment

    $. &!/ $ Initial Position

    %. & NP HP/ $ 3ewriting ! by rule $

    0. &A3T N-+N

    HP/

    $ 3ewriting NP by rule % and

    0

    &NA7' HP/ $

    6. &N-+N HP/ % 7atching A3T with the

    &NA7' HP/ $

    8. &HP/ 0 7atching N-+N with do$s

    &NA7' HP/ $

    9. &H'3/ 0

    &H'3 NP/ 0 3ewriting HP by rule 8*B

    &H'3 NP PP/ 0

    &H'3 PP/ 0

    &NA7' HP/ $

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    30/79

    5. The parse succeeds as

    H'3 is matched to criedleaving an empty

    grammatical symbol list

    with an empty sentence

    4ottom up parsing:

    ottom up parsing approach for 3TN become very comple( hence it is consideredfor only Top*down approach in 3TN.

    In a bottom up parser we use the rule to take a seuence A3T A=> N-+N that you

    have found and identify it as NP.

    The basic tool for bottom*up parsing is to take a seuence of symbols and match it

    to the right hand side of our rules. 7atches are always considered from the point of one

    symbol called key. To find rules that match a string involving the key look for rules thatstart with key or for rules that have already been started by earlier keys and reuire the

    present key either to complete the rule or e(tend the rule.

    Let us consider the following :FD)

    $. !NP HP

    %. NP A3T A=> N-+N

    0. NPA3T N-+N

    In the above grammar if you start with A3T in the input as key then rule %and 0are matched. To record this for analy#ing the ne(t key you need to record that rule % and

    0 could be continued at the point after the A3T. ou denote this fact by writing the rule

    with a dot &./ indicating what has been seen so far. Thus you record

    %. NPA3T. A=> N-+N

    0. NPA3T. N-+N

    If ne(t key is an A=> then rule 6 may be started and the modified rule % may be

    e(tended to give

    . NPA3T A=>. N-+N

    ;e keep a record of the state of a bottom*up parse in a structure called a chart.

    This structure is a record of the position of the words and the new structures derived

    from the sentence.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    31/79

    The chart also maintains the record of rules that have matched previously but are not

    completed. ou record these rules as active arcs on the chart.

    For the previous discussion the chart is as follows) FID*$

    A3T$ A=>$ NPA3T. N-+N NPA=>. N-+N

    NPA3T. A=> N-+N

    NPA3T A=>. N-+N

    In the above chart there are two completed constituents ? namely A3T$ and A=>$

    and four active arcs)* Two possible NPs beginning with A3T from $and % and an NP

    beginning with an A3T and A=> from $ to 0 and NP beginning

    with A=> from % to 0.

    or e"ample consider using the algorithm on the sentence

    The large can can hold the water with the following le(icon)

    The) A3T

    large) A=>

    can) A+, N-+N H'3

    hold) N-+N H'3

    water) N-+N H'3

    !ince the key list is stack new keys derived by rules matched by the entry of one of

    these words will be processed before the ne(t word entry is considered.

    :onsider the trace of the parse. The key list is initially empty so the word theisread and the constituent A3T$ placed on the key list.

    'ntering A3T$) &the from $ to %/

    Adds an active arc NPA3T. A=> N-+N from $ to %

    Adds an active arc NPA3T. N-+N from $ to 0

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    32/79

    These arcs are added by the step % of the algorithm and were derived from rules % and 0.

    Ne(t word large is read a constituent A=>$ I created.

    'ntering) &large from % to 0/

    Adds arc NPA=>.N-+N from % to 6 &step%/

    Adds arc NPA3T A=>. N-+N from $ to 0&step 0/

    This is added here is an e(tension of the first active arc added with A3T$ and results

    from step 0 of the algorithm.

    This chart we have already referred in previous pages.

    Notice that active arcs are never removed from the chart even when the arc from rule

    % from $ to % was e(tended producing the arc from $ to 0 both arcs remained on the

    chart. This is necessary because the arcs could be used again in different way by anotherinterpretation.

    The ne(t word canthree constituents N-+N$ A+,$ and H'3$ are created from

    its three interpretation.

    'ntering N-+N$) &can from 0 to 6/

    No active arcs are added in step % but two are completed in step 0 by N-+N$

    producing two NPs which are added to key list in step 6.

    First NP from $ to 6 is constructed from rule %.!econd NP from % to 6 is constructed from rule 6.

    These NPs are now at the top of stack of keys.

    'ntering NP$) an NP from $ to 6 adding active arc !NP.HP from $ to 6.

    'ntering NP%) an NP from % to 6 adding arc !NP.HP from % to 6.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    33/79

    FID*%

    The large can

    !NP.HP

    NPA3T.N-+N

    NPA3T A=>.N-+N

    !NP.HP

    NPA3T.A=> N-+N

    NPA=>.N-+N

    Now other senses of can are considered

    'ntering A+,$) &can from 0 to 6/

    Adding Arc HPA+,. H'3 NP from 0 to 6.

    'ntering H'3$) &can from 0 to 6/

    Adding Arc HPH'3. NP from 0 to 6.

    The ne(t word read is can again and N-+N% A+,% H'3% are created

    'ntering N-+N%) &can from 6 to 8 the second can/

    Adds no active arcs 'ntering A+,%) &can from 6 to 8/

    Adds arc HPA+,. H'3 NP from 6 to 8

    'ntering H'3%) &can from 6 to 8/

    Adds arc HPH'3. NP from 6 to 8

    Adds arc HPA+, H'3. NP from 0 to 8

    =eveloped by =r +mesh :handra >aiswal

    NP % &rule 6/

    NP $ &rule %/

    A3T $ A=> $ N-+N $

  • 8/12/2019 Class Notes of NLP--5

    34/79

    The ne(t word is hold and N-+N0 and H'30 are created)

    'ntering N-+N0) &hold from 8 to 9/

    Adds no active arcs.

    'ntering H'30) &hold from 8 to 9/

    Adds arc HPH'3. NP from 8 to 9

    Adds arc HPA+, H'3. NP from 6 to 9

    FID*0

    NP% &rule 6/

    NP$ &rule %/

    N-+N$ N-+N%

    H'3$

    H'3% H'30

    A3T$ A=>$ A+,$ A+,% N-+N0

    $ The % large 0 can 6 can 8 hold 9

    !NP. HP

    HPA+, H'3. NP

    NPA3T A=>. N-+NHPA+, H'3. NP

    !NP. HP

    The chart after adding hold omitting all active arcs covering only one position.

    'ntering A3T%) &the from 9 to 5/

    Adding arc

    NPA3T. A=> N-+N from 9 to 5

    Adding arc

    NPA3T. N-+N from 9 to 5

    'ntering N-+N 6) &water from 5 to B/

    No active arc added in step %

    An NP NP0 from 9 to B is pushed onto the key list by completing

    Arc NPA3T. N-+N from 9 to 5

    'ntering NP0) &the water from 9 to B/

    A HP HP$ from 6 to B is pushed onto the key list by completing

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    35/79

    HPA+, H'3. NP from 6 to 9

    A HP HP% from 8 to B is pushed onto the key list by completing

    HPH'3. NP from 8 to 9

    At this stage the chart is shown on previous page as FID*0.

    'ntering HP% &hold the water from 8 to B/

    No active arcs added

    'ntering HP$ &can hold the water from 6 to B/

    An ! !$ are added from $ to B by completing arc

    !NP.HP from $ to 6

    An ! !$ is added from % to B by completing arc

    !NP.HP from % to 6

    !ince we have derived an ! covering the entire sentence hence we stop here.

    The final chart is shown in FID*8.

    FID*6

    NP% &rule6/

    NP$ &rule %/

    N-+N$ N-+N% NP0 &rule 0/

    H'3$ H'3% H'30 H'36

    A3T$ A=>$ A+,$ A+,% N-+N0 A3T% N-+N6

    $ the % large 0 can 6 can 8 hold 9 the 5 water B

    !NP.HP HPA+, H'3.NP !NP.HP

    The charts after all the NPs are found omitting all but crucial arcs.

    FID*8

    !$&rule $/

    !%&rule$/

    NP% &rule 6/ HP$ &rule8/

    NP$&rule%/ HP% &rule9/

    N-+N$ N-+N%

    NP0 &rule0/

    H'3$ H'3% H'30 H'36

    A3T$ A=>$ A+,$ A+,% N-+N0 A3T% N-+N6

    $ the % large 0 can 6 can 8 hold 9 the 5 water B

    The final chart position.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    36/79

    Mixed Mode MethodsTop*down and bottom*up methods both have their advantages and disadvantages.

    Top*down methods for instance have the advantage that they will never considerword category in positions where they could not occur in a legal sentence. This is because

    the top*down parser works from a syntactic category and checks the word whether the

    word fits that category or not.

    :onsider the following grammar)

    $. !NP HP 8. NPA3T A=> N-+N

    %. !NP A+, H'3 9. NPA=> N-+N

    0. !NP H'3 5. HPA+, H'3 NP6. NPA3T N-+N B. HPH'3 NP

    :onsider the sentence)

    The can fell

  • 8/12/2019 Class Notes of NLP--5

    37/79

    Now consider the following sentence)

    $The %green 0water 6evaporated.8

    The) A3Tgreen) A=> N-+N

    water) N-+N H'3

    evaporated) H'3

    Pure Top*down works as follows)

    +urrent state 4ackup state Position

    &!/ NIL $

    Note that a state generates new parse states by operating on its leftmost symbol. If itnames a word category the ne(t word in the sentence is checked@ otherwise the grammar

    is used to rewrite the first symbol. 3eplacing ! using rules $ % and 0)

    +urrent state 4ackup state Position

    &NP HP/ $

    &NP A+, H'3/ $

    &NP H'3/ $

    3ewrite NP in the current state using rule 6 8 Q 9)

    +urrent state 4ackup state Position

    &A3T N-+N HP/ &A3T A=> N-+N HP/ $

    &A=> N-+N HP/ $

    &NP A+, H'3/ $

    &NP H'3/ $

    The sentence is checked for an A3T and then a N-+N successfully finding the first

    NP to be constructed but you would like to record the NP on the chart. ut in pure top*down there is no option for recording the seuence A3T N-+N produced an NP.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    38/79

    To record the NP the system should be e(tended to keep each symbol on the list

    even after it has been rewritten. The system marks the symbol as being rewritten and

    records the starting position of the phrase.

    or /"ample

    If NP is rewritten at position $ it will put a new structure SNP$ called aconstruction flag on the list when NP is rewritten. ;hen it arrives back at SNP$ in the

    parse later it will be able to tell that it has "ust completed an NP structure that began at

    position $.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    39/79

    Revised Algorithm for Processing a Single Position5. If the leftmost symbol in the current state names an entry on the chart then generate

    the new state&!/ by removing the symbol and updating the sentence position to the

    position&!/ after the chart entry&ies/.

    +urrent #tate 4ackup #tate Position

    &NP HP/ NIL $

    NP

    NP

    $ % 0 6 8

    Two NPs are found on the chart and two new states are generated. -ne becomes newcurrent state and other one works as backup i.e. the resulting situation is

    +urrent #tate 4ackup #tate Position

    &HP/ %

    &HP/ 6

    . If the leftmost symbol is a construction flag such as SNP$ add a constituent onto

    the chart for symbol. The range NP is from starting position &$/ to the current

    position.

    ;. -therwise if the symbol is a terminal symbol check the ne(t word in the sentence for

    inclusion in the category and add to the chart if successful.

  • 8/12/2019 Class Notes of NLP--5

    40/79

    Diven the state &NP HP/ at position $ and an empty chart three new states are

    produced

    A3T N-+N SNP$ HP

    A3T A=> N-+N SNP$ HP

    and A=> N-+N SNP$ HP all at position $.

    G-5

    NP$

    A3T$ N-+N$

    $ the % green 0 water 6 evaporated

    =. -therwise this state is re"ected and a backup state is moved to become the current

    state.

    Let us parse the above sentence &The green water evaporated/ with this method or

    algorithm.

    If you start with symbol ! and position$ ! is rewritten as

    +urrent state 4ackup state Position

    &NP HPS!$/ $

    &NP A+, H'3 S!$/ $

    &NP H'3 S!$/ $

    3ewriting NP as per step6 produces

    +urrent state 4ackup state Position

    &A3T N-+N SNP$ HPS!$/ $

    &A3T A=> N-+N SNP$ HP S!$ $

    &A=> N-+N SNP$ HP S!$/ $

    &NP A+, H'3 S!$/ $

    &NP H'3 S!$/ $

    The sentence is checked for A3T and N-+N successfully.

    The current state after these operations

    &SNP$ HP S!$/ at position 0

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    41/79

    The construction flag SNP$ is processed as per step % by adding to the chart an NP

    structure NP$ from position $ to 0. ou will have following parser state the chart as

    shown in FID*$ on previous page.

    +urrent state 4ackup state Position

    &HP S!$/ 0

    &A3T A=> N-+N SNP$ HP S!$/ $

    &A=> N-+N SNP$ HP S!$/ $

    &NP A+, H'3 S!$/ $

    &NP H'3 S!$/ $

    3ewriting HP produces

    +urrent state 4ackup state Position

    &A+, H'3 NP SHP$ S!$/ 0

    &H'3 NP SHP$ S!$/ 0

    &A3T A=> N-+N SNP$ HP S!$/ $

    &A=> N-+N SNP$ HP S!$/ $

    &NP A+, H'3 S!$/ $

    &NP H'3 S!$/ $

    The current state is registered since water cannot be classified as an A+,. The topbackup state becomes the current state and water is classified as a H'3. ut this is also

    re"ected because no NP is following the verb.

    The ne(t backup state succeeds since A3T can be found at position $ an A=>

    &green/ at position % and noun &water/ at position 0 creating a second NP the following

    is the situation and chart)

    +urrent state 4ackup state Position

    &HPS!$/ 6

    &A=> N-+N SNP$ HP S!$/ $&NP A+, H'3 S!$/ $

    & NP H'3 S!$/ $

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    42/79

    NP%

    NP$

    N-+N$ H'3$

    A3T$ A=>$ N-+N%

    $ the % green 0 water 6 evaporated

    3ewriting HP at position 6 in the current state creates the following situation

    +urrent state 4ackup state Position

    &A+, H'3 NP SHP% S!$/ 6

    U &H'3 NP SHP%S!$ 6

    &A=> N-+N SNP$ HP S!$/ $

    &NP A+, H'3 S!$/ $

    &NP H'3 S!$/ $

    !ince no A+, at position 6 so the current state is re"ected. y the first backup for

    position 6 we find H'3 at position 6. ut no NP after H'3 hence this also fails.

    Ne(t backup state also fails because thecannot be an A=>.

  • 8/12/2019 Class Notes of NLP--5

    43/79

    The current state is re"ected as there is no A+, at position 0@ further first backup

    state is also re"ected as no A+, at position 6. The correct interpretation is found by

    continuing from state &NP H'3 S!$/ once again we find two NPs on the chartproducing the following states)

    +urrent state 4ackup state Position

    & H'3 S!$/ 0&H'3 S!$/ 6

    The current state produces an ! structure from position $ to 0 but cannot account for

    word evaporated. The backup state produces the desired analysis i.e.@ recogni#ing a

    sentence of the form as given below in the tree diagram.

    NP%

    NP$

    N-+N$ H'3$

    A3T$ A=>$ N-+N% H'3%

    $ The % green 0 water 6 evaporated

    #

    NP HP

    A3T A=> N-+N H'3

    The green water evaporated

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    44/79

    ;hatever we discussed so far was not able to characteri#ing certain forms of

    dependencies between constituents such as sub"ect verb agreement verb transitivity and

    etc. Now we will discuss the e(tension of 3TN i.e. augmented grammatical formalisms

    that can deal with these issues.

    If we need to analy#e a sentence further one structure we have seen earlier

    that is parse tree.

    For e(ample one noun phrase may be as syntactic sub"ect &!+/ and other as the

    syntactic ob"ect &->/ within noun phrases you might identify the determiner structure

    ad"ectives the head noun and so on.

    For e(ample

    >ack found a dime.

    ! !+ &NP NA7' >A:E/

    7AIN*H found

    T'N!' PA!T

    -> &NP ='T a

    s

  • 8/12/2019 Class Notes of NLP--5

    45/79

    ;hen a pop is followed all the registers set in the current network are automatically

    collected to form a structure consisting of Network name

    List of registers with their values

    An 3TN with registers and lists and actions on those registers is an

    augmented transition network.

    FID*$

    NP Herb

    A !imple transition network

    Now the uestion arises as to how an action gets a value by which a register is to

    be set.;hen a cat arc such as verb is followed the word in the input is put into a specialvariable named VWX.

  • 8/12/2019 Class Notes of NLP--5

    46/79

    :onsider the following sentences

    Flying planes is dangerous

    The sub"ect is the activity of flying planes.

    Flying planes are dangerous.

    The sub"ect is a set of planes that are flying.

    aiswal

    !

    !%

    !0

    !$

    NP*PL+3ALNP

    $$P

    P

    NP%

    NP*!IND NP0NP6

  • 8/12/2019 Class Notes of NLP--5

    47/79

    A better solution is to allow words &and syntactic structures/ to have features as

    well as a basic category. This can be done by using the slot value list notation. This

    allows you to store number information as well as other useful information about the

    word in a data structure called the le(icon.

    Now e(tend the 3TN by adding a test to each arc in the network. A test is simply a

    function that is said to succeed if it returns a non*empty value such as a set or atom and

    to fail if it returns the empty set or nil. If test fails its arc is not traversed.

    '(ample)

    :onsider the following grammar. This grammar is capable of accepting

    sentences involving intransitive or transitive verbs simple noun phrases consisting of a

    proper noun &name/ or simple definite descriptions with ad"ectives. This also enforces

    number agreement with le(icon given on ne(t page.

    ad" %

    Art noun pop

    NP) $ $

    %

    Name

    NP Herb NP pop

    !) $%

    >ump

    %ord 0epresentation

    =ogs &N-+N 3--T =-D

    N+7 O0p/

    =og &N-+N 3--T =-D

    N+7 O0s/

    The &A3T 3--T T

  • 8/12/2019 Class Notes of NLP--5

    48/79

    A &A3T 3--T A

    N+7 O0s/

    :ried &H'3 3--T :3

    N+7 O0s 0p/

    Loves &H'3 3--T L-H'

    N+7 O0s/

    Love &H'3 3--T L-H'

    N+7 O0p/

    ;ild &A=> 3--T ;IL=/

    >ohn &NA7' 3--T >-!Append OA=>! W

    NP$% none NA7'W

    N+7N+7W

    !$ none !+>W

    !$$ N+7 !+>Y N+7 7AIN*HW N+7N+7!+>YN+7

    !%$ ->W

    3egisters containing structures that themselves are the values of another register can be

    accessed using subscript notations. Thus

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    49/79

    N+7!+>This represents N+7 register of the structure in the !+> register

    and N+7W is the N+7 reg. of the structure in W * that is the structure created by

    following the arc.

    The values of registers are often viewed as sets and the intersection &Y/ and union

    &U

    / of sets is allowed to perform operations on different registers. Append function is allowed )

    '(ample) Append &A=>! W/

    This returns the list in the registers A=>!

    with values of W appended on the end.

    A register without subscripts refers to a register of the current network.

    Tests allowed include checking for a particular value in register &For e(ample

    N+7!+>Z0!/ and for nonnull intersection of two registers containing sets of

    features &N+7 Y N+7/.

    Now consider the following sentence

    The dogs love >ohn

    .

    The ATN in previous grammar first we check agreement between theand dogs.

    The can be either singular or plural but dogs must be plural so the noun phrase

    constructed will have N+7 feature plural &as a result of the action on arc NP$/

    This NP is assigned to the !+> register and then checked for agreement with

    verb.

    The following is the trace for the sentence) $The %dogs 0love 6>ohn.8

    #tep Node Position Arc ollowed 0egister

    $. ! $ !$ Attempted &arc trace is

    given below./

    8. 0 !$ succeeds !+>&NP ='T the

    ohn

    N+7 O0s/

    4. !0 8 !0$ succeeds since no 3eturns

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    50/79

    words left &! !+> &NP ='T the

    &NP NA7' >ohn

    N+7 &0s///

    For recursive trace see the following Table

    Trace of First NP call) Arc 9

    #tep Node Position Arc ollowed 0egister

    % NP $ NP$ ='T the

    N+7O0s0p

    0 NP$ % NP$

    :heck if

    O0s 0pY O0p

    Not empty

    ohn

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    51/79

    N+7 O0s/

    Subject-Verb Agreement ;e have discussed about simple analysis of number agreement

    between sub"ect and verb.

    The other dimension along which sub"ect and verb must agree is the person.

    Person is e(plicitly indicated in 'nglish in the pronoun system consisting of

    First person I we

    !econd person you

    Third person he she it they

    All non pronominal sub"ects are considered to be the third person. Let us

    combine these features.

    :onsider the following e(ample)

    I love ;e love

    ou love ou love

    aiswal

  • 8/12/2019 Class Notes of NLP--5

    52/79

    Thus for love we can represent O$s %s $p %p 0p

    and for loves O0s

    Take another verb

    sawO$s %s 0s $p %p 0p

    is O0s

    are O%s $p %p 0p

    am O$s

    and so on.

    ;ith these we can easily define a test called

    Agr&feature$ feature%/

    This takes two feature sets and computes their intersection. If this intersection is null

    the test fails otherwise test succeeds and returns the value of intersection)

    Thus Agr &O0s 0p O$s %s $p %p 0p/

    !ucceeds with O0p

    Agr &O%s %p O$s %s $p %p 0p/

    !ucceeds with O%s %p

    while Agr &O0s O%s $p %p 0p/

    This fails.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    53/79

    Auxiliar-Verb agreement

    :onsider the following sentences

    I can see the house.

    I will have seen the house.

    I was watching the movie. I should have been watching the movie.

    I will be seen at the house.

    The (er* forms

    orms eature Name /"ample

    Infinitive inf go be say decideM

    Present pres go goes am is say says...

    Present Participle ing going being saying decidingMPast Participle en gone been said decidedM

    Past Participle past went was said decidedM

    The rules are encoded as a procedure.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    54/79

    Au( Agree &Herb au(*list/ this takes the ne(t verb &au(iliary or main/ in a

    seuence and checks whether it satisfies the restrictions of the last au(iliary seen &the last

    element of au(*list/.

    The procedure is as given below)

    Au( Agree &v au(*list/

    If au(*list Z nil

    Then if F-37HZ pres or past

    Then succeed and return T

    'lse fail

    Let L Z LA!T &au(*list/

    If 3--TLZ ' Q F-37HZ ing

    Then succeed and return PA!!IH'@ If 3--TL Z

  • 8/12/2019 Class Notes of NLP--5

    55/79

    have have

    will not be allowed.

    Verb om!lement The complement structure of a verb includes the NPs and clauses that

    immediately follow the verbs.

    Information about the complement structure is often called the sub

    categori#ation of verb.

    Intransitive verbs allow no NPs

    Transitive verbs allow one NP &ob"ect/

    itransitive verbs allow two NPs &Indirect ob"ect direct ob"ect/

    Transitive verbs that allow second NP to follow the verb. These verbs will be classified

    as benefactive because they can be followed by an NP that indicates for whom the action

    is done.

    These components will be encoded in a !+ :AT slot in the definition of each

    verb.

    N-N'no components allowed &Intransitive/

    ->single ob"ect &NP/ allowed to follow verb &Transitive/

    I->->two NPs allowed to follow verb &itransitive/

    !ome verbs such as seen and be can take an ad"ective phrase as a complement as

    >ack seemed angry.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    56/79

    !ometimes an ob"ect and ad"ective ->A=> as

    >ack makes me angry

    Now consider the following sentence)

    >ack put the money on the counter-> PP

    Now consider the complements that are clauses. The following are the possibilities)

    F-3*T-*INF I prayed for the doctor to come in time.

    -> T-*INF I persuaded him to do it.

    T-*INF I tried to do it.

    -> INF I saw him do it.

    INF I helped do it.

    The tensed complements all involve a clause with normal tense information of

    regular sentence. These clauses are often introduced by the complementi#er that.

    :ombining this feature with NP complement you find the following two combinations)

    Tack left.

    I know >ack left.

    -> Tack told 7ary that he had lost his bicycle.

    Another common complement form involves the use of wh words such as ? what why

    when and how as complementi#er.

    /"ample[ I know what >ack said.

    I know how many times I tried to fly.

    ;ack said.

    -> ;ack whether it was raining.

    To present tests concisely in the following grammars consider these

    functions where f is an arbitrary sub categori#ation feature set

    Intrans &f/ Z f Y ON-N' A=> F-3*T-*INF T-*INF INF T

  • 8/12/2019 Class Notes of NLP--5

    57/79

    Trans &f/ Z f Y O -> I-> -> -> T-*INF -> INF -> A=>

    -> PP -> T ;

  • 8/12/2019 Class Notes of NLP--5

    58/79

    Arc Test Actions

    !$ !+>W

    7--==':L

    !%$ Agr & N+7 !+> N+7 FI3!T*

    H/A+,!A+,!W7AIN*H

  • 8/12/2019 Class Notes of NLP--5

    59/79

    FI3!T*H W

    A+,$$ Au(Agree &W A+,!/ A+,! Append &A+,! W/

    If FI3!T*H Z nil then FI3!T*H W

    A+,%$ Au(Agree &W A+,!/ A+,! Append &A+,! W/

    If FI3!T*H Z nil then FI3!T*H W

    A+,0$ Au(Agree &W A+,!/ aiswal

    NP% NP0 NP

  • 8/12/2019 Class Notes of NLP--5

    60/79

    NP% ***** P3= W

    NP0 Agr &N+7W O0P/ ! Append &A=>! W/

    NP%% Agr &N+7 N+7 W/ ohn came to our party.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    61/79

    )er* complement and presetting registers

    Let us consider the further e(tension of ATNs for feature manipulation. This

    e(tension involves the ability to present registers in a network as that network is being

    called like parameter passing in programming language. This facility is called the

    !'N='3 action in the original ATN systems is useful to pass information to network

    that aids in analy#ing the new constituent.

    :onsider the class of verbs including want and pray that accepts complements using

    the infinitive form of verbs which usually introduced by the word to

    T-*INF 7ary wants to have a party

    ->*T-*INF 7ary wants >ohn to have a party

    F-3*T-*INF I prayed for >ohn to leave the party

    In the above e(ample au(iliaries are missing. ohn to dress himself in the closet

    * 7ary wants to dress himself in the closet

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    62/79

    * 7ary wants >ohn to dress herself in closet

    The last two sentences are unacceptable because the gender of the refle(ive

    pronoun does not agree with that of the understood sub"ect in the complement. To

    enforce such a restriction the grammar needs to access the gender of the !+>':T in

    the complement.

    FID*$

    NP

    $ pop

    %

    NP "ump

    NP $

    % "ump 0

    H'3! 0 P+!< &!% !+>->/

    pop

    P+!< &!% !+>!+>/

    Arcs Test Action

    !00 If !+:AT7AIN*H Z T-*INF :-7P W

    !60 If !+:AT7AIN*HZ -> T-*INF :-7P W

    The final ! network for T-*INF :omplements

    =eveloped by =r +mesh :handra >aiswal

    ! !% !0

    !6

    !9

    !8

  • 8/12/2019 Class Notes of NLP--5

    63/79

    Thus it would be useful to be able to preset the !+> register in the ! network

    when it is called. An e(tended push arc is of the following form allows presetting)

    P+!< &N S register in N SZ Sregister in current network/

    For e(ample

    P+!< &!% !+> SZ !+>/

    The above will push to node !% in the ! network and preset the !+>

    register in the new ! network to the value of the !+> register in the current ! network.

    This is reuired for 7ary wants to have a party.

    For second case 7ary wants >ohn to have a party

    ou need a call of the form.

    P+!< &!% !+> SZ ->/

    The last problem to consider is how to deal with the word to. ohn to have a partyX is parsed as follows)

    !+> &NP$ NA7' 7ary/

    7AIN*H wants -> &NP% NA7' >ohn/

    Following are !60 do push for the complement the trace is as follows)

    Node Arc followed 0egisters

    !% !%$ A+,! Z &to/

    7AIN*H have

    !0 !0$ -> &NP &='T a

  • 8/12/2019 Class Notes of NLP--5

    64/79

    Augmenting chart Parsers8Augmented +G9

    'ach :FD rule has tests and action associated with it that manipulate registers on

    the chart. The test associated with a rule may e(amine the chart entries for the

    constituents matching the right hand side of the rule and action builds a slot*value

    structure to add onto the chart. =uring the parse whenever a rule is completed its test is

    tried if it succeeds a new constituent is constructed using the actions associated with the

    rule and then added to the chart.

    For e(ample)

    NP A3T N-+N

    ;ith the test

    N+7 A3TY N+7 N-+N

    And the actions='T A3T

    N+7 N+7A3T Y N+7N-+Naiswal

  • 8/12/2019 Class Notes of NLP--5

    65/79

    the value of its !

    -T

    8. NP NA7' ****** do ****** NA7' NA7'

    N+7 N+7NA7'

    9. ! HP NP N-+NA3T Y N+7 N-+N N-+NA3T Y N+7N-+N

    !+> NP

    P3'= HP

    5. HP H'3 ******* do ******* 7AIN*H H'3

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    66/79

    N+7 N+7H'3

    B. HP H'3 NP ******* do********* 7AIN*H H'3

    -> NP

    N+7 N+7H'3

    '(ample :onsider the sentence

    The dog cried.

    !tart with a parse state of an ! at position $. 3ewriting ! symbol with rule 9

    produces the state

    &NP HP S!$ r9/ at position $.

    Now rewriting NP with rules $ % and 8 we get

    +urrent #tate 4ackup #tate Position

    &A3T A=>! N-+N SNP$ r$

    HP S!$ r9/

    $

    &A3T N-+N SNP$ r%HPS!$ r9/ $

    &NA7'SNP$ r8HPS!$ r9/ $

    In processing A3T ne(t the system first checks the chart but it is empty. Therefore

    it checks the input sentence at position $ and succeeds. After adding the entry onto the

    chart it has the following possibilities.

    :hart Table*$

    =eveloped by =r +mesh :handra >aiswal

    $ the % dog 0 cried

    A3T$ 3--T T

  • 8/12/2019 Class Notes of NLP--5

    67/79

    Ne(t rule0 is used for A=>! but dog is not an ad"ective hence this rule fails and top

    backup state becomes the current state this is given as follows)

    +urrent #tate 4ackup #tate Position

    & A=>! N-+N SNP$ r$ HP

    S!$ r9/

    %

    &A3T N-+N SNP$ r%HPS!$ r9/ $

    &NA7'SNP$ r8HPS!$ r9/ $

    Ne(t

    &A3T N-+N SNP$ r% HPS!$ r9/ $

    A3T$ is already on the chart so the current state is updated to

    &N-+NSNP$ r% HPS!$ r9/ %

    It does not find on chart therefore it looks for the input sentence and succeeds.

    :hart Table*%

    After parsing the first NP

    Ne(t is the constructor flag SNP$ r%. The system checks the tests on rule %Mthat

    is it checks whether the N+7 of A3T$ agrees with the N+7 of N-+N$. If thissucceeds then it adds a constituent NP$ to the chart as shown in the above :hartTable*%.

    +urrent #tate 4ackup #tate Position

    & H'3 SHP$ r5 S!$ r9/ 0

    &H'3 NP SHP$ rB S!$ r9/ 0

    &NA7' SNP$ r8 HP S!$ r9/ $

    =eveloped by =r +mesh :handra >aiswal

    &HP S!$ r9/ 0 &NA7' SNP$ r8 HP S!$ r9/ $

    $ the % dog 0 cried

    NP$ ='T A3T$

  • 8/12/2019 Class Notes of NLP--5

    68/79

    :heck the input sentence for a H'3 succeeds and a constituent H'3$ for cried

    is added to the chart.

    T T &NP ='T A3T$

  • 8/12/2019 Class Notes of NLP--5

    69/79

    Grammar for natural language$ %andling movement+onsider the following sentences

    >ohn went to store.

    =id "ohn go to the store\

  • 8/12/2019 Class Notes of NLP--5

    70/79

    If you want to know who did the action\

    This may be written as

    ;hich man will angrily put the book in the corner\

    or ;ho will angrily put the book in the corner\

    If you are interested to know how it is done

    ou might ask as

    aiswal

    !

    !$

    !% !0 !6

  • 8/12/2019 Class Notes of NLP--5

    71/79

    !$$ ****** FI3!T*NP W

    !%$ If Agr &N+7FI3!T*NPN+7FI3!T*H H'3/ 7AIN*H W

    -> W

    A ! network for very single yes ? no uestion

    The sentences

    I love you.

    and =o I love you\

    This would have the analysis as given .

    I love you =o I love you\

    &! 7--= =':L &! 7--= '!*N-*1

    FI3!T*NP &NP P3- I/ FI3!T*NP &NP P3- I/

    7AIN*H love A+,! &do/ -> &NP P3- you// 7AIN*H love

    -> &NP P3- you//

    Important Points)

    $. !tructures constructed for assertion and yes ? no uestions are identical

    e(cept for the 7--= register and the A+,! register which may contain ane(tra =-.

    %. All the tests performed for sub*verb agreement tense and transitivity are

    identical in both the sentences.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    72/79

    Passives7ost verbs e(cept the intransitive verbs may take the passive forms.

    This form involves using the normal ob"ect position NP in the sentence

    where the sub"ect normally goes and either omitting the NP usually in the sub"ect

    position or putting it in a PP position with the prepositionby.

    The passive form is indicated by adding an au(iliary verb with root befollowed

    by a past participle. The tense information in passives is encoded entirely in the au(iliary

    verbs.

    For e(ample) Active voice sentences

    * I will hide my hat in the drawer.

    * I hide my hat in the drawer.

    * I had hid my hat in the drawer.

    * I was hiding my hat in the drawer

    Passive voice sentences

    * 7y hat will be hidden &by me/ in the drawer.

    * 7y hat was hidden &by me/ in the drawer.

    * 7y hat had been hidden &by me/ in the drawer.

    * 7y hat was being hidden &by me/ in the drawer.

    =eveloped by =r +mesh :handra >aiswal

  • 8/12/2019 Class Notes of NLP--5

    73/79

    ou can deal with passives by setting a new register H-I:' to the value

    A:TIH' or PA!!IH' accordingly and by assigning the first noun phrase in the sentence

    to a register FI3!T*NP and then assigning it to the register !+> or -> as

    appropriate after the verb group is analy#ed.

    To handle passives the H'3! and ! network is given on ne(t page as FID*$.

    This &!*network/ works as follows)

    KThe initial NP is stored into a register FI3!T*NP and later assigned to !+>

    register or -> register as appropriate. This is accomplished in the annotation on arc

    !%% after checking au(iliary*verb agreement and sub"ect*verb agreement

    au( PP

    $ $

    $ NP verb $NP $NP pop

    %% % %

    % 0 >ump 0 "ump

    Au( NP >ump

    P+!/

    Arc Test Actions

    !$ ****** FI3!T*NPW7--==':L

    !% ****** A+,!Append &A+,! W/FI3!T*HW

    !$$ ****** FI3!T*NPW7--='!*N-*1

    =eveloped by =r +mesh :handra >aiswal

    ! !% !0 !6 !8

    !$

  • 8/12/2019 Class Notes of NLP--5

    74/79

    !%$ Au(Agree &W A+,!/ IF FI3!T*H Z nil

    Then FI3!T*HWA+,!Append &A+,! W/

    !%% Au(Agree &W A+,!/If FI3!T*H not nil then

    Agr &N+7FI3!T*NP N+7FI3!T*H/else Agr &N+7FI3!T*NP N+7W/

    7AIN*HWIf 3--T LA!T &A+,!/ Z '

    QF-37 Z enthen H-I:'PA!!IH'

    !+>FI3!T*NP

    'lse H-I:'A:TIH'

    ->FI3!T*NP

    !0$ Trans &!+:AT7AIN*H/

    QH-I:' Z A:TIH'

    FI3!T*->W

    !0% H-I:' Z PA!!IH'

    !00 Intrans &!+:AT7AIN*H/

    !6$ !+:AT 7AIN*HZ I->-> ->W

    I->FI3!T*->

    ->FI3!T*->!60 !+:AT 7AIN*HZ ->INF :-7PW

    ->FI3!T*->

    !8$ ********* 7-=!Append &7-=! W/

    In the test the action check for the passive form and assign the H-I:' !+> and ->

    register as appropriate. This grammar does not set !+> when a PP is found with the

    preposition bybecause it cannot be certain that the sub"ect is being indicated without

    semantic information about the type of the NP. If the NP describes an animate being

    perhaps it should be sub"ect. -therwise it is probably "ust a simple modifier as in the

    following e(ample

    The hat was hidden by three oGclock.

    $ modal $ have $ be $ be $verb pop

    % % % % %>ump "ump "ump "ump "ump

    Arc Test Actions

    H'3$ A+,$$A+,%$ A+,0$

    Au(.Agree&W A+,!/ A+,!Append &A+,! W/If FI3!T*H Znil

    =eveloped by =r +mesh :handra >aiswal

    H'3!

    A+,

    $A+,

    %

    A+,

    0

    A+,

    6

    A+,

    8

  • 8/12/2019 Class Notes of NLP--5

    75/79

    Then FI3!T*HW

    A+,6$ Au(.Agree&W A+,!/

  • 8/12/2019 Class Notes of NLP--5

    76/79

    Finally we need a mechanism to detect and fill gaps. The ATN mechanism uses a new

    arc called HI3 &short of virtual/ which takes a constituent name as an argument. This arc

    can be followed if such a constituent is present on the hold list.

    au( PP

    NP NP

    $ Herb $ "ump $ NP $ pop

    %

    0 % %

    HI3 NP "ump

    0 % 6Au( NP

    NP HI3 NP "ump

    au(

    All annotations arc as in grammar for passi(es plus actions as gi(en

    in following Ta*le

    Arc Test Actions!0 TP' Z ;<

  • 8/12/2019 Class Notes of NLP--5

    77/79

    !06 Intrans &!+:AT 7AIN*H/ ***

    An #-network for wh-and $es-no uestions

    If the arc is followed successfully the constituent is removed from the hold list and

    returned as the value of the arc in the identical form similar to a P+!< returns a

    constituent.

    :onsider the grammar which is the e(tension of the passive network.

    The arc from ! basically divides the sentence into the three categories)

    =':L '!*N-*1 and ;aiswal

    NP NP%

    NP0

  • 8/12/2019 Class Notes of NLP--5

    78/79

    Arc Test Actions

    NP$ *** ='TW@N+7N+7W

    NP% *** ='T

    W@TP';aiswal

  • 8/12/2019 Class Notes of NLP--5

    79/79