You are on page 1of 8

ADITYA COLLEGE OF ENGINEERING

PUNGANUR ROAD, MADANAPALLE-517325


IV-B.Tech (R13) II Sem- I Internal Examinations FEB-2017 (Descriptive) (CODE B)
(13A05802) NATURAL LANGUAGE PROCESSING (Computer Science & Engineering)
Time: 90 min Max Marks: 30

Part A
(Compulsory)
1. Answer the following questions.
a. Define Grammar & Parsing.
A system for describing a language, the rules of a language. A formal system for describing the syntax of a language.
Parsing or syntactic analysis is the process of analysing a string of symbols, either in natural language or in computer
languages, conforming to the rules of a formal grammar.
b. List various forms of verbs.
Main verbs have three basic forms: the base form, the past form and the -ed form (sometimes called the -ed
participle):
base form: used as the infinitive form, with to or without to (Do you want to come with us? I cant leave now.) and for
the present simple (I always read before I go to sleep every night.) except third person singular, which uses the -s form
(She works at the university.)
past form: used for the past simple (He opened the door and went out.)
-ed form: used after auxiliary have and be (Ive always wanted a piano and I was given one last week.).
c. Explain Particles.
Particles are the words that help to construct some verb forms Particles generally overlap with the class of
prepositions
d. Define Clausal complements.
Many verbs allow clauses as complements. Clauses share most of the same properties of sentences and may have a
subject, indicate tense, and occur in passivized forms. One common clause form consists of a sentence form preceded
by the complementizer that, as in that Jack ate the pizza. This clause will be identified by the expression S[that],
indicating a special subclass of S structures. This clause may appear as the complement of the verb know, as in Sam
knows that Jack ate the pizza. The passive is possible, as in Sam knows that the pizza was eaten by Jack. Another
clause type involves the infinitive form of the verb. The VP[inf] clause is simply a VP starting in the infinitive form, as in
the complement of the verb wish in Jack wishes to eat the pizza. An infinitive sentence S[inf] form is also possible
where the subject is indicated by a for phrase, as in Jack wishes for Sam to eat the pizza. Another important class of
clauses are sentences with complementizers that are wh-words, such as who, what, where, why, whether, and how
many. These question clauses, S[WH], can be used as a complement of verbs such as know, as in Sam knows whether
we went to the party and The police know who committed the crime.
e. What makes a good grammar?
Generality
The range of sentences the grammar analyzes correctly
Selectivity
The range of non-sentences it identifies as problematic
Understandability
Simplicity of the grammar itself.
Part-B
UNIT-I & II
2.(a) List various applications of NLP.
Text-based applications involve the processing of written text, such as books, newspapers, reports, manuals,
e-mail messages, and so on. These are all reading-based tasks.
Text-based natural language applications are:
Finding appropriate documents on certain topics from a database of texts
Extracting information from messages or articles on certain topics
Translating documents from one language to another
Summarizing texts for certain purposes
Machine Translation
Fighting Spam
Information Extraction
Summarization
Sentiment Analysis
Text Classification

Dialogue-based applications involve human-machine communication. Typical potential applications include


Question-answering systems, where natural language is used to query a database
Automated customer service over the telephone
Tutoring systems, where the machine interacts with a student
Spoken language control of a machine
General cooperative problem-solving systems

(b) Draw the parse tree for the following sentence. the visitor saw the old painting in the den.

(c) Explain about grammars and logic programming.


A popular method of building a parser for CFGs is to encode the rules of the grammar directly in a logic
programming language such as PROLOG. It turns out that the standard PROLOG interpretation algorithm
uses exactly the same search strategy as the depth-first top-down parsing algorithm, so all that is
needed is a way to reformulate context-free grammar rules as clauses in PROLOG.
Ambiguous words would produce multiple assertionsone for each syntactic category to which they
belong.For each syntactic category, you can define a predicate that is true only if the word between the
two specified positions is of that category, as follows:

n(I, O): word(Word, I, O), isnoun( Word)


art(I, O): word(Word, 1, O), isart(Word)
v(I, O): word(Word, 1, O), isverb(Word)
name(I, O) : word(Word, I, O), isname( Word)

It is also possible to insert chart-like mechanisms to improve the efficiency of a grammar, although then
the simple correspondence between context-free rules and PROLOG rules is lost. It is worthwhile to try
some simple grammars written in PROLOG to better understand top-down, depth-first search.

or
3. (a) What are Auxiliary or Helping Verbs?
Helping verbs or auxiliary verbs such as will, shall, may, might, can, could, must, ought to, should, would, used to,
need are used in conjunction with main verbs to express shades of time and mood. The combination of helping
verbs with main verbs creates what are called verb phrases or verb strings.
(b) Discuss all the kinds of Auxiliaries with example? How to Identify an Auxiliary Verb?
There are two main types of verbs. Action verbs are used to depict activities that are doable, and linking verbs are
used to describe conditions. Both action verbs and linking verbs can accompany auxiliary verbs including the three
main ones: do, be, and have.
A main verb, also known as a base verb, indicates the kind of action or condition taking place. An auxiliary or helping
verb accompanies the main verb and conveys other nuances that help the reader gain specific insight into the event
that is taking place.
Three Common Auxiliary Verbs
There are just three common auxiliary verbs:
Have
Do
Be
Have
Have is a very important verb that can stand alone in all its tenses, including has, have, having, had, and hadnt or
had not. It is usually used to denote ownership, and it can also be used to discuss ability or describe appearance.
Have is also a very popular substitute for the verbs eat and drink. For example: Lets have dinner.
When used as an auxiliary verb, have is always teamed up with another verb to create a complete verb phrase,
making it easy to differentiate between uses.
Do
Do can be used as an action verb that stands alone in all its tenses, including to do, do, does, done, did and didnt,
doesnt or did not .
When used as an auxiliary verb, do is always paired up with another verb to create a complete verb phrase. In some
cases, it is used to add emphasis: I did put the garbage out! Do is often used to form questions and negated
clauses. It is also used in elliptical sentences, where the main verb is understood and is omitted as a result.
Be
Be or to be is an important verb that has a multitude of uses in English. It can be used as an action verb that
stands alone in all its tenses including be, to be, been, am, are, is, was, were, wasnt, was not arent, are not, werent
and were not.
When used as an auxiliary verb, be is always paired with another verb to create a complete verb phrase. It can be
singular or plural, present or past. Negative sentences are formed by adding the word not.
Modal Auxiliary Verbs
In addition to the three main auxiliary verbs, have, do, and be, there are additional auxiliary verbs. These are called
modal auxiliary verbs, and they never change form. A complete list of modal auxiliary verbs follows:
Can
Could
May
Might
Must
Ought to
Shall
Should
Will
Would
(c) Give some examples of multiple auxiliary?

Functional meaning Verb combination Example


Perfect aspect form of auxiliary verb have + perfect active participle have been
Progressive aspect form of auxiliary verb be + progressive active participle be being
Passive voice form of auxiliary verb be + passive participle been deceived
UNIT- II & III
4. (a) What do you mean by Unification of two literals?
Unification is a "pattern matching" procedure that takes two atomic sentences, called literals, as input, and returns
"failure" if they do not match . All variables in the given two literals are implicitly universally quantified. To make
literals match, replace (universally-quantified) variables by terms.
Two feature structures A and B unify ( A B) if they can be merged into one consistent feature structure C:
Otherwise, unification fails:

(b) Explain Syntax, Semantics & Pragmatics.


Syntax It refers to arranging words to make a sentence. It also involves determining the structural role of words in
the sentence and in phrases.
Semantics It is concerned with the meaning of words and how to combine words into meaningful phrases and
sentences.
Pragmatics It deals with using and understanding sentences in different situations and how the interpretation of
the sentence is affected.
(c) Describe in detail with an example Indefinite noun phrases and Definite Noun Phrases.
In linguistics, definiteness is a semantic feature of noun phrases (NPs), distinguishing between
referents/entities that are identifiable in a given context (definite noun phrases) and entities which
are not (indefinite noun phrases). In English, for example, definite noun phrases preclude asking
"which one?"

There is considerable variation in the expression of definiteness across languages and some
languages do not express it at all. For example, in English definiteness is usually marked by the
selection of determiner. Certain determiners, such as a/an, many, any, either, and some typically
mark an NP as indefinite. Others, including the, this, every, and both mark the NP as definite.
or
5. . Write short notes on the following
a. Shift Reduce Parser.
Using techniques that encode uncertainty, so that the parser need not make an arbitrary choice and later
backtrack.
Rather, the uncertainty is passed forward through the parse to the point where the input eliminates all but
one of the possibilities.
If you did this explicitly at parse time, you would have an algorithm similar to the breadth-first parser.
All the possibilities are considered in advance, and the information is stored in a table that controls the
parser, resulting in parsing algorithms that can be much faster.
These techniques were developed for use with unambiguous context-free grammars.

But these techniques can be extended in various ways to make them


applicable to natural language parsing.
Shift Reduce Parser Elements
Parse Stack
Input Stack
Shift/Reduce Actions
Parse (Oracle) Table
Reduce Action: The states that consist of a single rule with the dot at the far right-hand side, such as S2',
S -> NP VP o
indicate that the parser should rewrite the top symbols on the parse stack according to this rule.The newly
derived symbol (S in this case) is pushed onto the top of the input stack.
Shift Action:
Any other state not containing any completed rules is interpreted by the transition diagram. If the top input
symbol matches an arc, then it and the new state (at the end of the arc) are pushed onto the parse stack.
Example :

Consider parsing "The man ate the carrot". The initial state of the parser is
Parse Stack Input Stack
(S0) (The man ate the carrot)
Looking up the entry in the table for state SO for the input ART
(the category of the word the), you see a shift action and a move to state S1:
Parse Stack Input Stack
(S1 ART S0) (man ate the carrot)
Looking up the entry for state S1 for the input N, you see a shift action
and a move to state S1:
Parse Stack Input Stack
(S1' N S1 ART S0) (ate the carrot)
Looking up the entry for state Si, you then reduce by rule 2.2, which removes the Si,,
N, 51, and ART from the parse stack and adds NP to the input stack:

Parse Stack Input Stack


(S0) (NP ate the carrot)
Again, consulting the table for state S0 with input NP, you now do a shift and move to
state S2:
Parse Stack Input Stack
(S2 NP S0) (ate the carrot)
Next, the three remaining words all cause shifts and a move to a new state, ending up with the parse state:
Parse Stack Input Stack
(S1' N S1 ART S3 V S2 NP S0)( )
The reduce action by rule 2.2 specified in state S1' pops the N and ART from the stack (thereby popping S1 and S1' as
well), producing the state:
Parse Stack Input Stack
(S3 V S2 NP S0) (NP)
You are now back at state S3, with an NP in the input, and after a shift to state S3', you reduce by rule 2.4,
producing:
Parse Stack Input Stack
(S2 NP S0) (VP)
Finally, from state S2 you shift to state S2 and reduce by rule 2.1, producing:
Parse Stack Input Stack
(S0) (S)
From this state you shift to state S0' and are in a position to accept the sentence.

b. POS
The process of assigning a part-of-speech or lexical class marker to each word in a corpus:

WORDS
TAGS
the
koala
put N
the V
keys P
on DET
the
table

Applications for POS Tagging


Speech synthesis pronunciation
Lead Lead
INsult inSULT
OBject obJECT
OVERflow overFLOW
DIScount disCOUNT
CONtent conTENT
Parsing: e.g. Time flies like an arrow
Is flies an N or V?
Word prediction in speech recognition
Possessive pronouns (my, your, her) are likely to be followed by nouns
Personal pronouns (I, you, he) are likely to be followed by verbs
Machine Translation

To do POS tagging, first need to choose a set of tags. We Could pick very coarse (small) tagsets N, V, Adj, Adv.
More commonly used tags are Brown Corpus 87 tags more informative but more difficult to tag. Most commonly
used is Penn Treebank 47 tags.

c. Viterbi
The Viterbi algorithm is used to compute the most probable path (as well as its probability). It requires knowledge of
the parameters of the HMM model and a particular output sequence and it finds the state sequence that is most
likely to have generated that output sequence. It works by finding a maximum over all possible state sequences.
In sequence analysis, this method can be used for example to predict coding vs non--coding sequences.
In fact there are often many state sequences that can produce the same particular output sequence, but with
different probabilities. It is possible to calculate the probability for the HMM model to generate that output
sequence by doing the summation over all possible state sequences. This also can be done efficiently using the
Forward algorithm (or the Backward algorithm), which is also a dynamical programming algorithm. In sequence
analysis, this method can be used for example to predict the probability that a particular DNA region match the
HMM motif (i.e. was emitted by the HMM model). A HMM motif can represent a TF binding site for ex.
ADITYA COLLEGE OF ENGINEERING
PUNGANUR ROAD, MADANAPALLE-517325
IV-B.Tech (R13) II Sem - I Internal Examinations FEB-2017 (Objective) (CODE B)
(13A05802) NATURAL LANGUAGE PROCESSING (Computer Science & Engineering)
Name: Roll No:

Time: 20 min Max Marks: 10

Answer all the questions 51=5M


1. What is a Garden path sentence?
A garden path sentence is a grammatically correct sentence that starts in such a way that a reader's most
likely interpretation will be incorrect; the reader is lured into a parse that turns out to be a dead end or
yields a clearly unintended meaning.They are called garden path sentences because they are easily
misunderstood (they lead you down the garden path) even though they are all grammatical!
Eg. "The old man the boat" (meaning "Old people are the crew of the boat")

2. What is a Discourse?
Any linguistic unit that consists of multiple sentences. It deals with how the immediately preceding sentence
can affect the interpretation of the next sentence.

3. Define Recursive Transition Network.


A transition network is a network consisting of nodes and labelled arcs. The nodes represent different states
of a process and the arcs represent the transitions from state to state, with labels refering to word categories in NLP.
A Recursive Transition Network (RTN) is a transition network which allows arc labels to refer to both word categories
as well as other networks. It has the same descriptive power as context-free grammars.

4. Give some examples for PFORM and VFORM.


VFORM Feature

Sample Rule: (VP) (V SUBCAT -np-vp:inf) (NP) (VP VFORM inf)


Example: (VP) (want SUBCAT -np-vp:inf) (class) (to end VFORM inf)

Prep. Phrases - PFORM Feature

Sample Rule: (VP) (V SUBCAT -np-pp:loc) (NP) (PP PFORM LOC)


Example: (VP) (put SUBCAT -np-pp:loc) (the tire) (on the cap PFORM loc)

5. What is definite clause grammar.


Definitive Clause Grammars use rules which are based on logical implication expressions. These
expressions are equivalent to Prolog clauses with the result that a Prolog interpreter can be used as a
parser for DCGs. An unadapted Prolog interpreter would perform a top-down, depth first parse which is
not particularly efficient. Rules in DCGs are Horn clauses which may have multiple antecedents but only a
single consequent. Non-terminal symbols in the grammar act as predicates, for example:
NounPhrase( NP ) VerbPhrase( VP ) Sentence( append( NP, VP ) )
In practice DCG rules are written like rules in other grammars (rather than as logical expressions) so the
rule above could be written:
Sentence NounPhrase VerbPhrase.
Rules are augmented to allow context sensitive checks to be specified, for example to ensure numeric
agreement between subject and verb thereby accepting sentences like "Catsplur playplur with string"
while rejecting others like "Catsing playplur with string". Typically such augmentations might be written:
Sentence NounPhrase(num (n)) VerbPhrase(num (n))
Additional augmentation allows semantics to be assembled for the target category of a rule
Sentence(semantics append(s1,s2)) NounPhrase(semantics (s1)) VerbPhrase(semantics ( s2))
The appearance of such rules becomes more complex when different augmentations are combined, ie:
Sentence (semantics append(s1,s2)) NounPhrase(num (n), semantics (s1)) VerbPhrase(num (n),
semantics (s2))
Rules are complicated further when transformations & checks are specified for semantic structures. DCGs
are popular because of their declarative style but are often associated with inefficient parsing strategies.

Choose the correct answer from following questions. 10 1/2 = 5 M


1. Natural Language Processing (NLP) is field of
a) Computer Science b) Artificial Intelligence c) Linguistics d) All of the mentioned [ d ]
2. One of the main challenge/s of NLP Is _____________ [ a ]
a) Handling Ambiguity of Sentences b) Handling Tokenization c) Handling POS-Tagging d) All of the mentioned
3. Modern NLP algorithms are based on machine learning, especially statistical machine learning.
a) True b) False [ a ]
4. The major tasks of NLP includes [ a,b,c,d ]
a) Automatic Summarization b) Discourse Analysis c) Machine Translation d) Semantic Analysis
5. Choose form the following areas where NLP can be useful. [ d ]
a) Automatic Text Summarization b) Automatic Question-Answering Systems c) Information Retrieval d) All the above
6. Parts-of-Speech tagging determines [ c ]
a) part-of-speech for each word b) part-of-speech for each word dynamically as per sentence structure and
meaning c) all of the mentioned
7.Parsing determines Parse Trees (Grammatical Analysis) for a given sentence. [ a ]
a) True b) False
8. The simplest NP consists of [ a ]
a) single pronoun b) single verb c) two pronouns d) single adjective
9. _______________ are the words that attribute qualities to objects yet do not refer to the qualities themselves
a) adjectives b)nouns c) pronouns d)Adverbs [ a ]
10. ____ mass or count nouns used to modify another noun,
a) noun modifiers b) Noun Phrases c) PRO d)None [ a ]

You might also like