20.2.1 Extracting Feature Vectors for Supervised Learning
The first step in supervised training is to extract a useful set of features that are predictive of word senses. As Ide and Véronis (1998b) point out, the insight that underlies all modern algorithms for word sense disambiguation was first articulated by Weaver (1955) in the context of machine translation:
If one examines the words in a book, one at a time as through an opaque mask with a hole in it one word wide, then it is obviously impossible to determine, one at a time, the meaning of the words. [...] But if one lengthens the slit in the opaque mask, until one can see not only the central word in question but also say N words on either side, then if N is large enough one can unambiguously decide the meaning of the central word. [...] The practical question is: “What minimum value of N will, at least in a tolerable fraction of cases, lead to the correct choice of meaning for the central word?”
To extract useful features from such a window, a minimal amount of processing is first performed on the sentence containing the window. This processing varies from approach to approach but typically includes part-of-speech tagging, lemmatization or stemming, and in some cases syntactic parsing to reveal information such as head words and dependency relations. Context features relevant to the target word can then be extracted from this enriched input. A feature vector consisting of numeric or nominal values is used to encode this linguistic information as an input to most machine learning algorithms.
Two classes of features are generally extracted from these neighboring contexts: collocational features and bag-of-words features. A collocation is a word or phrase in a position-specific relationship to a target word (i.e., exactly one word to the right, or exactly 4 words to the left, and so on). Thus collocational features encode information about specific positions located to the left or right of the target word. Typical features extracted for these context words include the word itself, the root form of the word, and the word's part-of-speech. Such features are effective at encoding local lexical and grammatical information that can often accurately isolate a given sense.
As an example of this type of feature-encoding, consider the situation where we need to disambiguate the word bass in the following WSJ sentence:
An electric guitar and bass player stand off to one side, not really part of the scene, just as a sort of nod to gringo expectations perhaps.
A collocational feature-vector, extracted from a window of two words to the right and left of the target word, made up of the words themselves and their respective parts-of-speech, i.e.,
$$ [w_{i-2},\mathrm{P O S}_{i-2},w_{i-1},\mathrm{P O S}_{i-1},w_{i+1},\mathrm{P O S}_{i+1},w_{i+2},\mathrm{P O S}_{i+2}] $$
would yield the following vector:
[guitar, NN, and, CC, player, NN, stand, VB]
The second type of feature consists of bag-of-words information about neighboring words. A bag-of-words means an unordered set of words, ignoring their exact position. The simplest bag-of-words approach represents the context of a target word by a vector of features, each binary feature indicating whether a vocabulary word w does or doesn't occur in the context. This vocabulary is typically preselected as some useful subset of words in a training corpus. In most WSD applications, the context region surrounding the target word is generally a small symmetric fixed size window with the target word at the center. Bag-of-word features are effective at capturing the general topic of the discourse in which the target word has occurred. This, in turn, tends to identify senses of a word that are specific to certain domains. We generally don't use stop-words as features, and may also limit the bag-of-words to only consider a small number of frequently used content words.
For example a bag-of-words vector consisting of the 12 most frequent content words from a collection of bass sentences drawn from the WSJ corpus would have the following ordered word feature set:
[fishing, big, sound, player, fly, rod, pound, double, runs, playing, guitar, band]
Using these word features with a window size of 10, example (20.1) would be represented by the following binary vector:
$$ [~0,0,0,1,0,0,0,0,0,0,1,0~] $$
We'll revisit the bag-of-words technique in Ch. 23 where we'll see that it forms the basis for the vector space model of search in modern search engines.
Most approaches to sense disambiguation use both collocational and bag-of-words features, either by joining them into one long vector, or by building a distinct classifier for each feature type, and combining them in some manner.