The present invention relates to natural language processing. More particularly, the present invention relates to the field of parsing natural human language.
In processing natural languages, such as English, Hebrew and Japanese, a parser is typically used in the analysis of sentences. A parser determines, for a sentence, the roles the words play and the interdependencies between those words. A first stage in parsing is breaking the input sentence into words and looking those words up in a lexicon to determine what parts of speech (POS) any word can have. For example the word “brachiate” can only be a verb, the word “sentence” could be a verb or noun, and “still” could be a noun, verb, adverb, as well as other parts of speech. There are also individual words that, when adjacent in a sentence, act as a unit as a different part of speech. For example “kind of” is treated as an adverb in the sentence “I kind of like her.” But in the sentence “It is a kind of cabbage,” the word “kind” is a noun and the word “of” is a preposition. Similar sets are “sort of,” “at least,” and “on the other hand.” These sets are called Multi-Word-Entries, or MWEs. A parsing system can assign many different types of parts of speech.
In addition, some parsers construct larger units from individual words before doing the syntactic parse. These larger units generally have internal structure that is not syntactic. For example, street addresses, time of day, and proper names all have internal structure that must be dealt with outside of syntax. In the sentence “David Parkinson visited 123 Elm Street at 11:30 AM,” the emphasized units (“David Parkinson”, “123 Elm Street” and “11:30 AM”) can be treated as a larger unit by the grammar component (which is responsible for syntax). These units are called factoids. However, some sentences could have conflicting factoids. For example in the sentence “After 1 second St. Augustine appeared” there are two overlapping factoids: “1 second St.” (which could be a street address), and “St. Augustine” (which could be a saint's name.) Other sentences could have items in them that might be incorrectly identified as a factoid if the entire context of the sentence is not considered. For example, in the Sentence “After I saw Henry Nixon walked into the room” we do not want “Henry Nixon” as a factoid.
The speed of a parser is dependent on how many different combinations of words it has to put together before it achieves a parse that spans the input sentence. There are many dead ends it could explore before finding the right way. For example, if it considers a part of speech for a word that does not make sense by building larger structures using it, then all that work is for naught. In a similar vein, if it considered a MWE as a first when it shouldn't have, or a factoid when the individual units are the correct one, then the parsing of that sentence will be slow. In addition, incorrect parses can be produced if the parser considers wrong parts of speech first. If an incorrect parse is generated before the correct one, and the parser decides to stop looking for the correct one, then an incorrect parse will be produced. The accuracy of factoid identification is also an issue. Confidence in whether a span is a factoid is done at two places in the system. When the factoid is constructed, and when the parse completes.
A Hidden Markov Model (HMM) using trigrams is a standard technique to predict which part of speech for each word is the preferred one in a given sentence. However, techniques for determining the parts of speech for MWE's and factoids are needed to improve parser performance. Also needed to improve parser performance are techniques to determine whether larger units, such as MWE's and factoids, should he considered first, or whether their individual pieces should be considered first by the parser.
A method of calculating trigram path probabilities for an input string of text containing a multi-word-entry (MWE) or a factoid includes tokenizing the input string to create a plurality of parse leaf units (PLUs). A PosColumn is constructed for each word, MWE, factoid and character in the input string of text which has a unique first (Ft) and last (Lt) token pair. TrigramColumns are constructed which define corresponding TrigramNodes each representing a trigram for three PosColumns. Forward and backward trigram path probabilities are calculated for each separate TrigramNode. The sums of all trigram path probabilities through each PLU are then calculated as a function of the forward and backward trigram path probabilities.
a is a flow diagram illustrating general methods of the invention.
b is a flow diagram illustrating sub-steps of the tokenizing step shown in
a–5e are illustrations of various sub-steps in the tokenizing step shown in
a and 6b illustrate an example of a PosColumn and a PosColumnArray in accordance with the invention.
a illustrates the elements of a Trigram Node.
b illustrates an example of a TrigramArray.
c illustrates an example of a TrigramGraph.
The invention is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
With reference to
Computer 110 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 110 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computer 100.
Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, FR, infrared and other wireless media. Combinations of any of the above should also be included within the scope of computer readable media.
The system memory 130 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 131 and random access memory (RAM) 132. A basic input/output system 133 (BIOS), containing the basic routines that help to transfer information between elements within computer 110, such as during start-up, is typically stored in ROM 131. RAM 132 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 120. By way of example, and not limitation,
The computer 110 may also include other removable/non-removable volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media discussed above and illustrated in
A user may enter commands and information into the computer 110 through input devices such as a keyboard 162, a microphone 163, and a pointing device 161, such as a mouse, trackball or touch pad. Other input devices (not shown) may include a joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 120 through a user input interface 160 that is coupled to the system bus, but may be connected by other interface and bus structures, such as a parallel port, game port or a universal serial bus (USB). A monitor 191 or other type of display device is also connected to the system bus 121 via an interface, such as a video interface 190. In addition to the monitor, computers may also include other peripheral output devices such as speakers 197 and printer 196, which may be connected through an output peripheral interface 190.
The computer 110 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 180. The remote computer 180 may be a personal computer, a hand-held device, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 110. The logical connections depicted in
When used in a LAN networking environment, the computer 110 is connected to the LAN 171 through a network interface or adapter 170. When used in a WAN networking environment, the computer 110 typically includes a modem 172 or other means for establishing communications over the WAN 173, such as the Internet. The modem 172, which may be internal or external, may be connected to the system bus 121 via the user-input interface 160, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 110, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation,
Memory 204 is implemented as non-volatile electronic memory such as random access memory (RAM) with a battery back-up module (not shown) such that information stored in memory 204 is not lost when the general power to mobile device 200 is shut down. A portion of memory 204 is preferably allocated as addressable memory for program execution, while another portion of memory 204 is preferably used for storage, such as to simulate storage on a disk drive.
Memory 204 includes an operating system 212, application programs 214 as well as an object store 216. During operation, processor 202 from memory 204 preferably executes operating system 212. Operating system 212, in one preferred embodiment, is a WINDOWS® CE brand operating system commercially available from Microsoft Corporation. Operating system 212 is preferably designed for mobile devices, and implements database features that can be utilized by applications 214 through a set of exposed application programming interfaces and methods. The objects in object store 216 are maintained by applications 214 and operating system 212, at least partially in response to calls to the exposed application programming interfaces and methods.
Communication interface 208 represents numerous devices and technologies that allow mobile device 200 to send and receive information. The devices include wired and wireless modems, satellite receivers and broadcast tuners to name a few. Mobile device 200 can also be directly connected to a computer to exchange data therewith. In such cases, communication interface 208 can be an infrared transceiver or a serial or parallel communication connection, all of which are capable of transmitting streaming information.
Input/output components 206 include a variety of input devices such as a touch-sensitive screen, buttons, rollers, and a microphone as well as a variety of output devices including an audio generator, a vibrating device, and a display. The devices listed above are by way of example and need not all be present on mobile device 200. In addition, other input/output devices may be attached to or found with mobile device 200 within the scope of the present invention.
System 300 can be considered to be a trigram path probability calculating system for calculating trigram path probabilities for an input string of text containing a multi-word-entry (MWE) or a factoid. System 300 includes a tokenizer 310, a PosColumn generator 320, a TrigramColumn generator 330, a Trigram Graph generator 340, a trigram path probability calculator 350 and a normalizer 360. Not all of the components illustrated in
Tokenize Input String of Text
a is a flow diagram illustrating methods of the invention. As shown at block 405 in
a illustrates an input string of text, “He sort of likes her.” The corresponding tokens are shown in
Referring back for the moment to
As shown in
A ParseLeafUnit (PLU) is defined as a word, MWE or factoid in a particular part of speech. Each PLU is also identified by its first token number (Ft) and its last token number (Lt). For PLUs that consist of a single token, then Ft is equal to Lt. For MWEs and factoids, Ft is less than Lt. The Ft,Lt token pairs for each PLU in the example sentence are shown in
Add Dummy Tokens and Construct PosColumnArray
Referring back to the flow diagram of
Two dummy tokens are also added to the end of the tokens for the text string. These two dummy tokens are assigned a part of speech referred to in this example as the “END” part of speech. These dummy tokens are given the token numbers n+1 and n+2, where n is the number of tokens in the sentence. In the example sentence shown in
Next, a PosColumn is constructed for each Ft,Lt token pair. A PosColumn consists of all PLUs that have the same Ft,Lt. An example of a PosColumn is shown in
Next, an array referred to herein as the PosColumnArray is formed. This is an array of all PosColumns for each Ft,Lt token pair in the string (including dummy tokens). In essence, the PosColumnArray is a 2D array of PLUs.
Construct TrigramColumns
Referring back to the flow diagram of
A TrigramColumn is a set of 3 PosColumns, for example PosColumns (PC1, PC2, PC3) from
For TrigramColumn (PC1, PC2, PC3) where PC1 has x PLUs, PC2 has y PLUs and PC3 has z PLUs, we can form x*y*z trigrams. Every combination of tokens in PC1, PC2 and PC3 produces a trigram.
Create Trigram Graph
Referring back to the flow diagram of
The Trigram Graph is ordered left to right, in increasing order of the Ft or Lt of its first PosColumn. Each TrigramNode represents a trigram that can be created from the three PosColumns in the corresponding TrigramColumn. From above: For TrigramColumn (PC1, PC2, PC3) where PC1 has x PLUs, PC2 has y PLUs and PC3 has z PLUs, there will be x*y*z TrigramNodes. A TrigramNode contains four probabilities:
With reference to the probability (Prob) defined above, in a Trigram model, the probability of each token is conditioned on the two previous tokens. So, the probability of token T[n] following tokens T[n−1], and T[n−2] is P(T[n]/T[n−1], T[n−2]) which is calculated from the training corpus.
Where,
There is an ordering of the TrigramArray. For example, the ith PLU of PC1 (0≦i<x), the jth PLU of PC2 (0≦j<y) and the kth PLU of PC3 (0≦k<z) form the (i*(y*z)+j*z+k) element of the TrigramArray. Note that (i+j*x+k*(x*y)) is a also a valid ordering—in reverse. In other words, the TrigramArray is formed by enumerating the elements of the three PosColumns. This is in essence a 3D array. For each TrigramNode, Tr, initialize:
Referring back to the flow diagram of
Logic of the computation:
The trigram paths from the left and the right are independent. Therefore, to find the sum of all paths through a trigram node, one can find (a) the sum of all trigram paths from the left (in the forward computation); and (b) the sum of all trigram paths from the right (in the backward computation). Then, multiply the sums found in (a) and (b) with the probability of that trigram. This is actually used in the standard HMM training algorithm, and it is what makes this algorithm linear instead of exponential.
Forward Propagation Computation
Next, as shown at block 445 in
For each TrigramColumn TCJ (i.e., 1≦J≦11 in the example) in the TrigramGraph from left to right (in increasing order of Ft or Lt of its first PosColumn), identify all neighbor TrigramColumns to the right. This is shown in block 510 of
Next, as shown at block 520, TrigramNodes Tr in the TrigramArray of TrigramColumn TCJ are identified. Since steps which follow are performed for each of these TrigramNodes in the TrigramArray of TrigramColumn TCJ, a current or next of these TrigramNodes is referred to here as TrA for purposes of illustration of the following steps. TrigramNode TrA consists of tokens of the form (t1, t2, t3), where (t1, t2, t3 ) represent a set of three token numbers.
Next, as shown in the step illustrated at block 530, to continue the trigram path, trigrams consisting of a set of tokens (t2, t3, tx) are identified. Token “tx” represents a token number not found in TrigramNode TrA, while token numbers t2 and t3 represent tokens found in both TrigrmNode TrA and in the trigrams identified as continuing the path.
Then, as illustrated at block 540, for each TrigramNode “TrB” having tokens of the form (t2, t3, tx), the forward propagation of the path probabilities is computed as follows:
TrB.leftProb=TrB.leftProb+TrA.prob*TrA.leftProb
Where,
These calculations are repeated for each TrigramNode “TrB” having tokens of the form (t2, t3, tx). Then, as shown at block 550, the process repeats for the next TrigramNode in the TrigramArray corresponding to TrigramColumn TCJ. As shown at block 560, the process is also carried out for all right neighbors of TrigramColumn TCJ. Blocks 570, 580 and 590 illustrate that the process is also repeated for each of the other TrigramColumns.
Backward Propagation Computation
As shown at block 450 in
For each TrigramColumn TCJ (i.e., 1≦J≦11 in the example) in the TrigramGraph from right to left (in decreasing order of Ft or Lt of its first PosColumn), identify all neighbor TrigramColumns to the left. This is shown in block 610 of
Next, as shown at block 620, TrigramNodes Tr in the TrigramArray of TrigramColumn TCJ are identified. Since steps which follow are performed for each of these TrigramNodes in the TrigramArray of TrigramColumn TCJ, a current or next of these TrigramNodes is referred to here as TrA for purposes of illustration of the following steps. TrigramNode TrA consists of tokens of the form (t1, t2, t3), where (t1, t2, t3) represent a set of three token numbers.
Next, as shown in the step illustrated at block 630, to continue the trigram path, trigrams consisting of a set of tokens (tx, t1, t2) are identified. Token “tx” represents a token number not found in TrigramNode TrA, while token numbers t2 and t3 represent tokens found in both TrigrmNode TrA and in the trigrams identified as continuing the path.
Then, as illustrated at block 640, for each TrigramNode “TrB” having tokens of the form (tx, t1, t2), the forward propagation of the path probabilities is computed as follows:
TrB.rightProb=TrB.rightProb+TrA.prob*TrA.rightProb
Where,
These calculations are repeated for each TrigramNode “TrB” having tokens of the form (tx, t1, t2). Then, as shown at block 650, the process repeats for the next TrigramNode in the TrigramArray corresponding to TrigramColumn TCJ. As shown at block 660, the process is also carried out for all left neighbors of TrigramColumn TCJ. Blocks 670, 680 and 690 illustrate that the process is also carried out or repeated for each of the other TrigramColumns.
Write Results Back for Each PLU
Referring again to
To get the sum of all trigram paths through that trigram, these three probabilities are multiplied together at every node. This can be seen, for example, in
Then, the sum of trigram paths through each PLU is calculated. This can also be seen diagrammatically in
For each TrigramNode Tr (pos1, pos2, pos3):
Pos3.PosProb=pos3.PosProb+tr.prob*tr.leftProb*tr.rightProb)
Each pos represents a word/mwe/factoid in a particular part of speech. Therefore pos3.PosProb represents that probability. This probability is not absolute, it is only relative to other pos's, i.e. relative to the same word/mwe/factoid in different parts of speech.
Re-normalize the PosProbs in Each PosColumn
At this point, each PLU has the sum of the probabilities of all trigram paths that pass through that PLU stored in the PosProb parameter. Their scores give their relative probability assignments. At this point, the PosProbs for each PosColumn are normalized, as illustrated at block 465 of
For each PosColumn, sum the PosProbs for each PLU, calling the sum SUM. Then for each PLU set:
PosProb=PosProb/SUM.
The relative probabilities of each PLU in a PosColumn are obtained using trigram estimation.
First Alternative PosProb Normalization Step
In order to re-normalize MWEs or factoids and their constituent PLUs, one could just use the technique described above. However, because larger units (MWEs and factoids) are in different PosColumns from their constituent PLUs, they are not necessarily normalized against each other. For instance, if each just had one part of speech, then the PosProb for both the larger unit and its constituents would be 1.0, and no differentiation would have been achieved. In order to differentiate, one must normalize each against the other. One alternative way to do this is to consider all PosColumns that contain a given token number and normalize them as a unit.
For each PosColumn that spans a given token number, sum the PosProbs for each PLU, calling the sum SUM. Then, for each PLU set:
PosProb=PosProb/SUM.
This is illustrated by way of example in
Second Alternative PosProb Normalization Step
One drawback with the first alternate step described above with reference to
For example, as shown in
For example,
Let F be a mwe/factoid that includes X, Y and Z where X, Y and Z are individual tokens (i.e. F=XYZ). A, B are tokens that appear before X, and C, D appear after Z. Then, for paths in which X, Y and Z are independent tokens, the probability calculation will be:
(Prob calculation for all tokens before A)*P(A/B,X)*P(B/X, Y)*P(X/Y, Z)*P(Y/Z, C)*P(Z/C, D)*(Prob calculation after Y)
For paths through F, the calculation is:
(Prob calculation for all tokens before A)*P(A/B,XYZ)*P(B/XYZ, C)*P(XYZ/C, D)*(Prob calculation after Y)
Thus, paths through a larger entity will be favored. To normalize this, one could set probability of P(X/Y,Z) and P(Y/Z, C) to be 1. That way, every path would have the same number of probabilities.
Exemplary System
Referring back to
Tokenizer 310 is configured to tokenize the input string of text to create parse leaf units (PLUs). In various embodiments, tokenizer 310 tokenizes the input string of text by assigning a token number, consecutively from left to right, to each word and character in the input string of text. The tokenizer (or another component) also identifies MWEs and factoids in the input string of text, and assigns parts of speech to each token, MWE and factoid.
PosColumn generator 320 is configured to construct a PosColumn for each word, MWE, factoid and character in the input string of text which has a unique first (Ft) and last (Lt) token pair associated therewith. This includes adding dummy tokens for positions immediately prior to the first word, MWE, factoid or character of the input string. It also includes adding dummy tokens for positions immediately after the last word, MWE, factoid or character of the input string. A “Begin” part of speech is assigned to dummy tokens for positions immediately prior to the first word, MWE, factoid or character of the input string. An “End” part of speech is assigned for positions immediately after the last word, MWE, factoid or character of the input string.
In constructing the PosColumn for each word, character and dummy token, the unique Ft and Lt token pair for that PosColumn has an Ft token number which is equal to the Lt token number. For each MWE and factoid, the Ft token number is less than the Lt token number. In addition to the unique Ft and Lt token pair, for each PLU in a particular PosColumn, the PosColumn further includes the corresponding assigned part of speech and a path probability for the PLU.
TrigramColumn generator 330 is configured to construct TrigramColumns corresponding to the input string of text. Each TrigramColumn defines a corresponding TrigramNode representing a trigram for three PosColumns in the TrigramColumn. Each TrigramNode is identifiable by a unique set of three tokens. TrigramColumn generator 330 is also configured to determine for each TrigramColumn all neighboring TrigramColumns to the immediate left and to the immediate right.
Trigram Graph generator 340 is configured to construct a Trigram Graph. The Trigram Graph includes with each of the constructed TrigramColumns an array of associated TrigramNodes. Each TrigramNode contains a probability of the corresponding trigram, the forward probability of all forward paths through the TrigramNode, the backward probability of all backward paths through the TrigramNode, and the sum of all trigram path probabilities of all paths through the TrigramNode.
Trigram path probability calculator 350 is configured to calculate the forward trigram path probability and the backward trigram path probability for each separate TrigramNode of each TrigramColumn. Calculator 350 also calculates the sums of all trigram path probabilities through each PLU as a function of the calculated forward and backward trigram path probabilities.
The trigram path probability calculator is further configured to calculate the forward trigram path probability for each separate TrigramNode of each TrigramColumn by calculating the forward trigram path probability, for each separate TrigramNode of each TrigramColumn, of all forward paths from a TrigramNode in a right neighboring TrigramColumn through the separate TrigramNode. The trigram path probability calculator is similarly configured to calculate the backward trigram path probability for each separate TrigramNode of each TrigramColumn by calculating the backward path probability, for each separate TrigramNode of each TrigramColumn, of all backward paths from a TrigramNode in a left neighboring TrigramColumn through the separate TrigramNode.
The trigram path probability calculator is further configured to calculate, for each TrigramNode, the sum of all trigram path probabilities of all paths through the TrigramNode by multiplying the probability of the corresponding trigram, the forward probability of all forward paths through the TrigramNode, and the backward probability of all backward paths through the TrigramNode. Calculator 350 calculates the sums of all trigram path probabilities through each PLU by adding the sums of all trigram path probabilities, from each TrigramNode, corresponding to a path through the PLU.
Normalizer 360 is configured to normalize, for each PLU, the sums of all trigram path probabilities for the particular PLU.
Although the present invention has been described with reference to particular embodiments, workers skilled in the art will recognize that changes may be made in form and detail without departing from the spirit and scope of the invention. For example, references to a string of text being stored or acted upon should be understood to include various representations, such as parse trees, of the string of text.
The present application is a continuation of and claims priority of U.S. patent application Ser. No. 09/907,315, filed Jul. 17, 2001 now U.S. Pat. No. 6,985,851, the content of which is hereby incoporated by reference in its entirety.
Number | Name | Date | Kind |
---|---|---|---|
4641264 | Nitta et al. | Feb 1987 | A |
5642519 | Martin | Jun 1997 | A |
6278967 | Akers et al. | Aug 2001 | B1 |
6490549 | Ulicny et al. | Dec 2002 | B1 |
6615172 | Bennett et al. | Sep 2003 | B1 |
6760695 | Kuno et al. | Jul 2004 | B1 |
20010056352 | Xun | Dec 2001 | A1 |
Number | Date | Country | |
---|---|---|---|
20050234717 A1 | Oct 2005 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 09907315 | Jul 2001 | US |
Child | 11151953 | US |