Bird's NLTK book
Natural Language Processing with Python by Steven Bird, Ewan Klein, and Edward Loper.
21 flashcards · Computer Science · by lakesare
What's a constituent structure?
Constituent structure is this tree starting from S, and ending with actual words. Each node (including S and actual words) is a constituent. Constituent structure is created by substituting word sequences. Working from the top row, we can replace particular sequences of words (e.g., the brook) with individual words (e.g., it); repeating this process, we arrive at a grammatical two-word sentence.
[Parsers] What's input and output of all parsers - RecursiveDescent, ShiftReduce, Chart parsers?
parser (sentence, grammar_rules) => the trees Parser searches through the trees our grammar allows, and returns all possible constituent structure trees.
[Parsers] Name one top-down and one bottom-up parser?
top-down - RecursiveDescent parser bottom-up - Shift-Reduce parser
In the sentence "Mary saw me" - what is the referent of the word "Mary", and the word "me"? A referent is a person or thing to which a name a linguistic expression or other symbol – refers.
The referent of "Mary" - person called Mary who is being spoken of. The referent of "me" - person uttering the sentence. Examples:- Before she dried off, Mary was wet.She and Mary MAY have the same referent (she may refer to Mary).- She dried off because Mary was wet.She and Mary normally don't have the same referent.
[Phrase structure grammars] In phrase structure grammars - what's a feature structure? Phrase structure grammars: generalised phrase structure grammar, head-driven phrase structure grammar, lexical functional grammar.
A set of attribute–value pairs. For example, the attribute named number might have the value singular.
Name 2 examples of semantic roles.
Name 2 examples of an agreement constraint in English language.
this dog *these dog Agreement for nounsIn English, nouns are usually marked as being singular or plural. The form of the demonstrative also varies: this (singular) and these (plural).the dog runs *the dog run Agreement for verbs
[Phrase structure grammars] We want to allow plurals WHILE constraining agreement. Why is this grammar suboptimal? Grammar (7) allows us to generate the sentence this dog runs; however, what we really want to do is also generate these dogs run AND block unwanted sentences like *this dogs run and *these dog runs.
It doubles each rule. With a small grammar, this is not really such a problem, although it is aesthetically unappealing. However, with a larger grammar that covers a reasonable subset of English constructions, the prospect of doubling the grammar size is very unattractive.
[Phrase structure grammars] If we want to allow plurals WHILE constraining agreement - what's a better form of grammar than this? Grammar (7) allows us to generate the sentence this dog runs; however, what we really want to do is also generate these dogs run AND block unwanted sentences like *this dogs run and *these dog runs.
We are using ?n as a variable over values of NUM. ?n it can be instantiated either to sg or pl, within a given production. NUM - number, ?n - variable, Det - determiner, sg - singular, pl - plural.
Determinant VS determiner?
Determinant Determiner The key difference between English adjectives and English determiners is that adjectives cannot function as determintives. For example, *I live in small house is ungrammatical because it lacks a determinative. The adjective small is a modifier, not a determinative. In contrast, if the adjective is replaced by a possessive (I live in my house) or a determiner (I live in that house), then it becomes grammatical because those can function as determinatives.
[Phrase structure grammars] If the determiner is not choosy for the NUM attribute - what's a better way to display it?
A more elegant solution is to leave the NUM value underspecified and let it agree in number with whatever noun it combines with. Assigning a variable value to NUM is one way of achieving this result. We can be even more economical, and just omit any specification for NUM in such productions. We only need to explicitly enter a variable value when this constrains another value elsewhere in the same production.
[Phrase structure grammars] Atomic feature values VS complex feature values?
atomic feature values - can't be decomposed So far, we have only seen feature values like sg and pl. These simple values are usually called atomic—that is, they can’t be decomposed into subparts. complex feature values - consist of features structures themselves In addition to atomic-valued features, features may take values that are themselves feature structures. For example, we can group together agreement features (e.g., person, number, and gender) as a distinguished part of a category, serv…
[Phrase structure grammars] What's the shortcut for the boolean feature values? V[TENSE=pres, aux=+] This feature value means 'auxiliary=true' A special case of atomic values are Boolean values, that is, values that just specify whether a property is true or false.
What are the issues with building the grammar for the entire language? Broad-coverage grammars Despite the problems, some large collaborative projects have achieved interesting and impressive results in developing rule-based grammars for several languages. Examples are the Lexical Functional Grammar (LFG) Pargram project, the Head-Driven Phrase Structure Grammar (HPSG) LinGO Matrix framework, and the Lexicalized Tree Adjoining Grammar XTAG Project.
Structural ambiguity Unfortunately, as the coverage of the grammar increases and the length of the input sentences grows, the number of parse trees grows rapidly. In fact, it grows at an astronomical rate. When we try to parse "fish fish fish fish fish" which among other things, means “fish that other fish fish are in the habit of fishing fish themselves.We get 2 parse trees: As the length of this sentence goes up (3, 5, 7, ...) we get the following numbers of parse trees: 1; 2; 5; 14; 42; 132;…
What does the PCFG look like? PCFG - probabilistic context-free grammar
It is sometimes convenient to combine multiple productions into a single line, e.g., VP -> TV NP [0.4] | IV [0.3] | DatV NP NP [0.3]. In order to ensure that the trees generated by the grammar form a probability distribution, PCFG grammars impose the constraint that all productions with a given lefthand side must have probabilities that sum to one.
What's a valency of the verb?
Valency is the capacity of the verb to take a specific type of a complement. That is, was can occur with a following Adj, saw can occur with a following NP.The dependents Adj, NP, S, and PP are often called complements of the respective verbs, and there are strong constraints on what verbs can occur with what complements.
Complement VS modifier/adjunct in linguistics?
complement - phrase that is necessary to complete the meaning of a given expression. Example: The squirrel was frightened.Example: Ryan is the boss.adjunct - optional part of a sentence, removal won't structurally affect the rest of the sentence. Example: The squirrel really was frightened.Example: In the sentence John helped Bill in Central Park. Unlike complements, modifiers are optional, can often be iterated, and are not selected for by heads in the same way as complements.
What's a lexical category?
Part of speech.
What is the head in this sentence? Dependency grammar - a distinct and complementary approach, focuses instead on how words relate to other words.
shot. The head of a sentence is usually taken to be the tensed verb, and every other word is either dependent on the sentence head or connects to it through a path of dependencies.
Name 4 categories of verbs (acc to how many arguments they take).
Intransitive verbs - VERB do not take any object (do not have an NP following them) as in Oscar died, Oscar slept.Transitive verbs - VERB ____ have a direct object: Oscar saw the table, Oscar called his wife.Ditransitive verbs - VERB ____ ____ take 'double objects': give a dog a bone, tell the children a story.Dative verbs - VERB ____ ____ take an object NP followed by an indirect object as a PP: put the rubbish in the bin, throw the plates on the floor.Sentential complement verbs - VERB __sent…
What kind of rule sends the RecursiveDescent parser into an infinite loop?
Left recursive rules: NP → NP PP. Recursive descent parsing has three key shortcomings. First, left-recursive productions like NP → NP PP send it into an infinite loop.