Week10
Week10
Introduction
Word senses
Wordnet
Word sense disambiguation
Introduction
A word sense is the locus of word meaning; definitions and
meaning relations are defined at the level of the word sense
rather than wordforms.
Words are ambiguous: the same word can be used to mean
different things.
Word sense disambiguation (WSD), has a very long history
in computational linguistics and many applications, e.g.
question answering.
Knowing the relation between multiple senses of a word
can play an important role in language understanding.
WordNet is a large database of lexical relations for English,
and a variety of languages.
CS3TM20 © XH 2
Word Senses
How can we define the meaning of a word sense?
We introduced the standard computational approach of
representing a word as an embedding, a point in semantic
space.
Dictionaries or thesauruses give textual definitions for each
sense called glosses.
bank:
1. financial institution that accepts deposits and channels the money into lending
activities
2. sloping land (especially the slope beside a body of water
Dictionaries often give example sentences along with
glosses, which are used to help build a sense
representation. CS3TM20 © XH 3
Relations Between Senses
• Synonymy
Synonyms include such pairs as
couch/sofa vomit/throw up filbert/hazelnut
car/automobile
• Antonymy
long/short big/little fast/slow cold/hot
dark/light rise/ fall up/ down
in/out
another group of antonyms, reversives, describe
change or movement in opposite directions, such as
rise/fall or
up/down CS3TM20 © XH 4
Hyponym/hypernym
CS3TM20 © XH 6
Metonymy
is the use of one aspect of a concept or entity to refer to other
aspects of the entity or to the entity itself.
We are performing metonymy when we use the phrase the
White House to refer to the administration whose office is
in the White House.
FRUITTREE ↔ FRUIT
(Plums have beautiful blossoms)(I ate a preserved plum
yesterday)
CS3TM20 © XH 7
Structured Polysemy
The senses of a word can also be related semantically,
We call the relationship between them structured
polysemy.
The bank is on the corner of Nassau and Witherspoon.
This sense, perhaps bank means something like “the
building belonging to a financial institution”.
These two kinds of senses occur together for many other
words as well (school, university, hospital, etc.).
Thus, there is a systematic relationship between senses
that we might represent as
BUILDING↔ORGANIZATION.
CS3TM20 © XH 8
Wordnet
CS3TM20 © XH 9
Word sense disambiguation :
CS3TM20 © XH 10
The Lesk algorithm
CS3TM20 © XH 11
The Lesk algorithm
CS3TM20 © XH 13
“The bank can guarantee deposits will eventually cover future
tuition costs because it invests in adjustable-rate mortgage
securities”
Bank1 Gloss: a financial institution that accepts deposits and channels
the money into lending activities
Examples: “he cashed a check at the bank”,
“that bank holds the mortgage on my home”
Bank2 Gloss: sloping land (especially the slope beside a body of water)
Examples: “they pulled the canoe up on the bank”,
“he sat on the bank of the river and watched the currents”
Answer: Sense Bank1 has two non-stop words overlapping
with the context, deposits and mortgage, while sense Bank2
has zero words, so sense Bank1 is chosen.
CS3TM20 © XH 14
Information extraction
Introduction
Named entity recognition
Information extraction
Chunking
Introduction
The process of information extraction (IE) turns the
unstructured information embedded in texts into structured
data, e.g for populating a relational database.
The task of relation extraction: finding and classifying
semantic relations among the text entities.
These are often binary relations like child-of, employment,
part-whole, and geospatial relations.
Information extraction systems generally simply identify and
classify the segments in a text that are likely to contain
valuable information.
One kind of partial parsing is known as chunking.
CS3TM20 © XH 16
Named Entities (NE) recognition
Named entity, in its core usage, means anything that can be referred to with
a proper name. Most common 4 tags:
• PER (Person): “Marie Curie”
• LOC (Location): “New York City”
• ORG (Organization): “Stanford University”
• GPE (Geo-Political Entity): "Boulder, Colorado"
Often multi-word phrases
But the term is also extended to things that aren't entities:
dates,
times,
prices
Segmentation issues
In POS tagging, no segmentation problem since each word
gets one tag.
In NER we must find and segment the entities!
Type ambiguity
Applications:
Sentiment analysis: consumer’s sentiment toward a particular
company or person?
Question Answering: answer questions about an entity?
Information Extraction: Extracting facts about entities from
text.
Information Extraction
Examples
Job market surveillance software
aspect level sentiment analysis
ACE project
Chunking (Partial Parsing)
Chunk
token
Chunk
token
Chunk
Why chunking?
Chunking can break sentences into phrases that are more
useful than individual words and yield meaningful results.
Chunking is very important when you want to extract
information from text such as locations, person names.
(entity extraction)
Easy to implement
22
Regex based Chunking
• Grammar
• <DT>? → one or zero determiner
<JJ>* → zero or more adjectives
<NN> → Noun
• Practical this week
>>> sentence = [("the", "DT"), ("little", "JJ"), ("yellow", "JJ"), ... ("dog", "NN"), ("barked", "VBD"), ("at",
"IN"), ("the", "DT"), ("cat", "NN")]
>>> grammar = "NP: {<DT>?<JJ>*<NN>}"
>>> cp = nltk.RegexpParser(grammar)
>>> result = cp.parse(sentence)
>>> print(result)
(S (NP the/DT little/JJ yellow/JJ dog/NN) barked/VBD at/IN (NP the/DT cat/NN))
>>> result.draw()
23
Machine learning based Chunking
• Annotation
• Penn Treebank dataset
• The chunk tags use the IOB format.
• IOB : Inside, Outside, Beginning
• B- prefix before a tag indicates, it’s the beginning of a chunk
• I- prefix indicates that it’s inside a chunk
• O- tag indicates the token doesn’t belong to any chunk
• Training a classifier
• Evaluation
24