Computational Grammar
Introducti on to Natural Language Processing and Context-Free Grammars
Ambiguity
Lexical ambiguity is when a word can have more than one meaning or multiple definitions, such as
“I saw her duck” in which ‘duck’ can have two meanings. Syntactical ambiguity is when the
structure of a sentence has multiple interpretations, such as “I saw the man with the telescope” in
which you either saw a man together with a telescope or you saw a man through a telescope.
Discourse ambiguity is when the meaning of a sentence is unclear leading to multiple
interpretations, such as “John took his car to the garage” in which ‘his’ can be connected to either
‘John’ or refer to a friend or 3rd person.
Levels of Analysis in Natural Language Processing
In phonology, the phonemes /k/ and /b/ are what differentiate the words “cat” and “bat”.
Morphology is about the structure of words, “jumped” is formed from the root word “jump” and
the suffix “ed”. Syntax is the structure of sentences from a set of rules, relationships of words and
the order, “the dog chased the cat” is formed/parsed in the order: subject – verb – object.
Pragmatics is the use of language by the speaker and interpretation of this language by the listener.
Discourse is how sentences are connected to construct meaning in a conversation/discourse.
Grammatical Structure
The grammatical structure of a sentence is called a constituency structure, a sentence composed of
constituents are identified by their function in the sentence and are used by probabilistic parsing
with the goal to identify the best syntax using a language model.
The grammatical structure of a sentence called dependency structure can also be represented by
defining the relationship between words instead of their function with dependencies in which the
grammatical relationship is indicated with directed edges as dependencies between words and each
word as a node, the relationship can be subject-object, modifier-head, or complement-verb.
CYK Parsing and PCFGs
Context-Free Grammar
A formalism to describe the syntax of language is called context-free grammar or CFG and are used
to parse and generate sentences following a set of rules, with each rule specifying a symbol non-
terminal (N) as the syntactic categories, and a terminal (α) as a set of words or sequence of
terminal and non-terminals.
CYK Algorithm
To determine the constituency structure of a sentence given a CFG in Chomsky Normal Form (CNF)
we use the dynamic-programming based bottom-up CYK algorithm as a parser for CFGs which
avoids recursion and solves by building larger constituent of smaller constituents.
Chomsky Normal Form
CNF is a specific from of CFG allowing rules of either N -> N N or N -> α and non-epsilon rules. One
way to convert CFG to CNF is splitting A -> B C D to A -> B X and X -> C D. Another way is by joining A
-> B C and B -> D to make A -> D C.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller s.2. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $5.97. You're not tied to anything after your purchase.