# Patent

## Title
Paraphrase acquisition

## Abstract

Methods and apparatus, including systems and computer program products, to acquire potential paraphrases from textual input. In one aspect, textual input is received, a first map is generated, where the key of the first map is an ngram identified in the textual input and the value associated with the key of the first map is a unique identifier, a second map is generated, where the key of the second map is an anchor identified from the ngram and the value associated with the key of the second map is one or more middle portions associated with the anchor, and a third map is generated, where the key of the third map is a potential paraphrase pair identified from the middle portions and the value associated with the key of the third map is the one or more unique anchors associated with the potential paraphrase pair.

## Background
BACKGROUND
This invention relates to the acquisition of paraphrases from text by automatic data processing systems.
Information captured in text, e.g., text stored in documents, can encode semantically equivalent ideas through different lexicalizations. Indeed, given the generative power of natural language, different people typically employ different words or phrases to convey the same meaning, depending on factors such as background knowledge, level of expertise, style, verbosity and personal preferences. Two semantically equivalent fragments of text may differ only slightly, as a word or a phrase in one of them is paraphrased in the other, e.g., through a synonym. Yet even small lexical variations represent challenges to any automatic process attempting to decide whether two text fragments have the same meaning, or are relevant to each other, since they are no longer lexically identical. Many natural-language intensive computer program applications include modules that make such decisions. In document summarization, the generated summaries have a higher quality if redundant information has been discarded by detecting text fragments with the same meaning. In information extraction, extraction templates will not be filled consistently whenever there is a mismatch in the trigger word or the applicable extraction pattern. Similarly, a question answering system could incorrectly discard a relevant document passage based on the absence of a question phrase deemed as very important, even if the passage actually contains a legitimate paraphrase.
Identifying different words or phrases with the same meaning can be useful in various contexts, such as identifying alternative query terms for a specific user query. Deciding whether a text fragment (e.g., a document) is relevant to another text fragment (i.e., the query) is generally crucial to the overall output, rather than merely useful within some internal system module. Indeed, relevant documents or passages may be missed, due to an apparent mismatch between their terms and the paraphrases occurring in the users' queries. The previously proposed solutions to the mismatch problem vary with respect to the source of the data used for enriching the query with alternative term.
SUMMARY
In particular implementations, the present invention provides methods and apparatus, including computer program products, implementing techniques for acquiring potential paraphrases from textual input.
In one aspect, textual input is received, a plurality of ngrams are identified, where each ngram is a sequence of words within the textual input, each identified ngram is divided into three portions: a beginning constant portion containing a first number of words at the beginning of the ngram, an ending constant portion containing a second number of words at the end of the ngram, and a middle portion containing the words of the ngram between the beginning constant portion and the ending constant portion, and an anchor for each ngram is determined, the anchor including the beginning constant portion and the ending constant portion of the ngram. If the anchor of a first ngram is the same as the anchor of a second ngram, the middle portion of the first ngram and the middle portion of the second ngram are identified as a potential paraphrase pair.
Advantageous implementations can include one or more of the following features. A named entity may be included as part of the anchor. A remainder of an adverbial relative clause modifying the named entity may be included as part of the anchor. All ngrams in all identified sentences may be identified, including overlapping ngrams. All potential paraphrase pairs may be identified. The number of unique anchors associated with each identified potential paraphrase pair may be counted to determine the quality of each potential paraphrase pair, where potential paraphrase pairs that are associated with a larger number of anchors are of higher quality than potential paraphrase pairs that are associated with a smaller number of anchors. The potential paraphrase pair may be a paraphrase pair if the number of unique anchors associated with the potential paraphrase pair is equal to or greater than a threshold value. A term may be received, the term comprised of a sequence of one or more words, one or more paraphrase pairs may be identified where the term is identical to a paraphrase member, where the middle portion of the first ngram is a first paraphrase member and the middle portion of the second ngram is a second paraphrase member, and the non-identical paraphrase member of each identified paraphrase pair may be added to a set of suggested alternatives for the term. Each ngram may have between seven and ten words. The first constant number of words may be three words, and the second constant number of words may be three words.
In other aspect, textual input is received, a first map is generated, where the key of the first map is an ngram identified in the textual input and the value associated with the key of the first map is a unique identifier, a second map is generated from the contents of the first map, where the key of the second map is an anchor identified from the ngram and the value associated with the key of the second map is one or more middle portions associated with the anchor, and a third map is generated from the contents of the second map, where the key of the third map is a potential paraphrase pair identified from the middle portions and the value associated with the key of the third map is the one or more unique anchors associated with the potential paraphrase pair.
Advantageous implementations can include one or more of the following features. The first map, second map, and third map may be generated using a distributed architecture of multiple computers. The distributed architecture of multiple computers may implement a map reduce infrastructure. The value of one or more anchors associated with the potential paraphrase pair key of the third map may be used to determine a quality of the potential paraphrase pair, where the potential paraphrase pair that has a larger number of unique anchors is of higher quality than the potential paraphrase pair that has a smaller number of unique anchors.
The invention can be implemented to realize one or more of the following advantages. Large sets of word- and phrase-level paraphrases are acquired by exhaustive pairwise alignment of sentence fragments across a large set of document sentences. Paraphrases are acquired from this pairwise alignment. The paraphrases are not limited to variations of specialized, domain-specific terms, nor are the paraphrases restricted to a narrow class such as verb paraphrases. High-quality, clean, trustworthy, or properly-formatted input data is not required; the input data can include inherently noisy, unreliable World Wide Web (Web) documents. The acquisition of paraphrases does not rely on external clues and attributes that two particular documents are parallel or that they report on the same or very similar events. The acquisition of paraphrases does not rely on tools that require a syntactic parser to provide a syntactic or dependency structure for the sentences. One implementation of the invention provides all of the above advantages.
The details of one or more embodiments of the invention are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the invention will become apparent from the description, the drawings, and the claims.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of two documents including sentences containing similar ngrams;
FIG. 2 is a flow chart illustrating a method to determine whether two or more ngrams contain a paraphrase pair; and
FIG. 3 is a flow chart illustrating operations performed in one implementation of a method for determining whether two or more ngrams contain a paraphrase pair.



Like reference numerals in the various drawings indicate like elements.
DETAILED DESCRIPTION
FIG. 1 illustrates a set of documents 100 that contains a first document 102A and a second document 102B, each with a sentence containing common word sequences. The set of documents 100 may include a large number of documents. For example, the set of documents 100 can include the approximately one billion documents contained in an archive of the Web.
The document 102A contains a sentence 104A and the document 102B contains a sentence 104B. A document can contain more than one sentence and a sentence can contain more than one word ngram. In this specification, a “word ngram” or “ngram” is defined to be a subsequence of words from a given string (i.e., sequence) of words. For example, all possible ngrams that can be generated from the string of words “he ran fast” are “he”, “ran”, “fast”, “he ran”, “ran fast” and “he ran fast”. In general, each ngram is a sentence fragment; however, it is possible for the ngram to be an entire sentence. In some implementations, all punctuation marks are ignored when generating ngrams.
Optionally, in identifying sentences, sentences in the documents can be filtered to exclude from the group sentences that are too complex or too simple to process. For example, sentences containing fewer than 5 words or more than 30 words can be excluded.
Other restrictions may be placed on the sentences; for example, all words in a sentence must contain fewer than 30 letters; a sentence must contain at least one verb that is neither a gerund nor a modal verb; a sentence must contain at least one word that is not a verb and is not capitalized; or fewer than half of the words in a sentence may be numbers. The first sentence 104A contains a first ngram that is potentially similar to a second ngram contained in the second sentence 104B, in the sense that there is a beginning constant portion of the first ngram which is potentially identical to a beginning constant portion of the second ngram, and an ending constant portion of the first ngram which is potentially identical to an ending constant portion of the second ngram. The beginning constant portions and ending constant portions are ‘constant’ because the number of words in each of the beginning constant portions is the same, and the number of words in each of the ending constant portions is the same.
Together, a beginning constant portion and an ending constant portion of a single ngram form what will be referred to as an anchor. If the anchors of two ngrams are identical, the middle portions between the beginning constant portions and the ending constant portions are considered to be a potential paraphrase pair. For example, in the set of documents 100, the beginning constant portion 108A in the ngram 106A is identical to a beginning constant portion 108B in the ngram 106B, and the ending constant portion 110A in the ngram 106A is identical to an ending constant portion 110B in the ngram 106B. Therefore, the middle portions 112A and 112B are a potential paraphrase pair.
FIG. 2 is a flow chart illustrating a method 200 for identifying ngrams within a body of text and for identifying potential paraphrase pairs using the identified ngrams. Although the method 200 is impractical for identifying potential paraphrase pairs within an extremely large body of text, this method is being described for its illustrative value. The textual input can be contained in one or more documents. The documents can contain information on any topic. Some or all of the documents can be poorly or inconsistently formatted, such as a set of documents from the Web.
Ngrams within the body of text and the anchors for each ngram are identified (step 202). In one implementation, all possible ngrams between seven and ten words in length in the set of documents 100 are evaluated, where the beginning and ending constant portions of the ngrams are each three words in length and a middle portion in between the beginning and ending constant portions is therefore between one and four words in length. In alternative implementations, the ngrams can be shorter than seven words in length or longer than ten words in length. In an additional implementation, the beginning constant portions of the ngrams are a first fixed number of words in length, the first fixed number being any integer greater than zero, and the ending constant portion of the ngrams are a second fixed number of words in length, the second fixed number being any integer greater than zero. The first fixed number of words need not be the same as the second fixed number of words. In one implementation, document metadata, such as Hypertext Markup Language (HTML) tags, are not included in the text from which ngrams are identified.
The anchor of a first ngram is compared to the anchor of a second ngram to determine if the word sequences between the anchors form a potential paraphrase pair (step 204). The first ngram 106A contains a middle portion 112A and the second ngram 106B contains a middle portion 112B. If the anchors of two ngrams are the same, the middle portions of the two ngrams form a potential paraphrase pair, and each middle portion is a paraphrase member of the potential paraphrase pair. Potential paraphrase pairs can contain synonymous paraphrase members or can contain other information, such as alternatives for commonly misspelled words or misused phrases. Each anchor pairing is compared; if the anchor pairings match, the word sequences between the anchors form a potential paraphrase pair as described above. This comparison continues until every anchor pairing has been considered (step 206). A first anchor in an ngram used in a comparison may include or overlap with a second anchor in the same ngram used in another comparison.
To reduce the number of potential paraphrase pairs that include unrelated paraphrase members, additional information for comparison can be included with the anchor of a ngram. Thus, in an alternative implementation, an anchor of a ngram can contain a beginning constant portion, an ending constant portion, and additional information.
In one implementation, a named entity (e.g., person, location, title, etc.) preceding a beginning constant portion and a named entity following an ending constant portion of an ngram are added to the anchor. If no named entity precedes the beginning constant portion or follows an ending constant portion, the ngram is discarded. In one implementation, in order to ensure robustness on Web documents, simple heuristics are applied to identify named entities. For example, any proper noun can be considered to be a named entity, and proper nouns can be identified by part-of-speech tags. Part-of-speech tags specify for each word its part-of-speech as well as some other additional information (e.g., proper nouns, singular vs. plural, etc.). A part-of-speech tagger can be used to determine the part-of-speech tags applied to each word; a suitable part-of-speech tagger is described in T. Brants, TnT—a Statistical Part-of-Speech Tagger, Proceedings of the 6th Applied NLP Conference, pp. 224-231 (2000).
In an implementation that makes use of named entities, in the first ngram 106A a named entity 114A preceding the beginning constant portion 108A is added to the anchor of the ngram 106A. In the second ngram 106B a named entity 114B preceding the beginning constant portion 108B is added to the anchor of the ngram 106B. In addition, a named entity 116A following the ending constant portion 110A is added to the anchor of the ngram 106A; and a named entity 116B following the ending constant portion 110B is added to the anchor of the ngram 106B. If the anchor of the first ngram 106A continues to match the anchor of the second ngram 106B after the addition of the named entities, the middle portions are considered a potential paraphrase pair.
In another implementation, to improve accuracy of the identified potential paraphrase pairs, the anchor of an ngram is only considered if the ngram is adjacent to an adverbial relative clause modifying a named entity or a date. In this case, the anchor includes a remainder of an adverbial relative clause following the ending constant portion of the ngram (the named entity forming the initial portion of the adverbial relative clause). To ensure robustness on Web documents, simple heuristics rather than complex tools can be used to identify the additional information added to the anchor. Adverbial relative clauses, together with the entities or dates they modify, can be detected according to a small set of lexico-syntactic patterns which can be summarized as <[Date|Entity] [,|-|(|nil] [Wh] RelClause [,|-|)|.]>, where Wh is one of “who”, “when”, “which”, or “where”. The patterns are based mainly on wh-words and punctuation. The matching adverbial clause RelClause must satisfy a few other constraints, which aim at avoiding, rather than solving, complex linguistic phenomena. First, personal and possessive pronouns are often references to other entities. Therefore, clauses containing such pronouns are discarded as ambiguous. Second, appositives and other similar pieces of information are confusing when detecting the end of the current clause. Consequently, during pattern matching, if the current clause does not contain a verb, the clause is either extended to the right, or discarded upon reaching the end of the sentence. In general, the addition of the remaining adverbial relative clause is a stricter requirement than the addition of named entities alone.
In an implementation that makes use of named entities and adverbial relative clauses, in the first sentence 104A the named entity 114A is modified by the ngram 106A. In the second sentence 104B the named entity 114B is modified by the ngram 106B. The named entities are added to the anchors of their respective ngrams. A remainder 118A of the adverbial relative clause modifying the named entity 114A is also added to the anchor of the ngram 106A. A remainder 118B of the adverbial relative clause modifying the named entity 114B is added to the anchor of the ngram 106B. In this implementation, the middle portion 112A and the middle portion 112B are not a potential paraphrase pair, because the adverbial relative clause remainder 118A does not match the adverbial relative clause remainder 118B.
For example, the sentence “Together they form the Platte River, which eventually flows into the Gulf of Mexico at the southern most tip of Louisiana” has three named elements: “Platte River”, “Mexico”, and “Louisiana”. One of the ngrams that can be extracted from this sentence is “River which eventually flows into the Gulf”. If the beginning constant portion is three words long and the ending constant portion is three words long, the anchor for this ngram, without considering any of the named entities, is “River which eventually into the Gulf”; “River which eventually” is the beginning constant portion and “into the Gulf” is the ending constant portion. If the named entity following the ending constant portion is added to the anchor of this ngram, the anchor for this ngram is “River which eventually into the Gulf of Mexico”. If the remainder of an adverbial relative clause modifying the named entity is also added to the anchor of this ngram, the anchor is “River which eventually into the Gulf of Mexico at the southern most tip of Louisiana”, as the adverbial relative clause modifying the named entity is “at the southern most tip of Louisiana”.
The implementations above allow an accurate set of potential paraphrase pairs to be identified from a set of poorly formatted documents 100. The documents 100 are not restricted to a particular genre, such as parallel news articles; and information external to the documents 100 is not required to validate the paraphrases. The filtering of ngrams and anchors is kept simple and does not include complex syntactic parsing, so that the set of documents 100 may be large without prohibitively increasing the amount of time needed to process the documents 100.
The number of times each potential paraphrase pair occurs is tallied (step 208). The number of times with which a given potential paraphrase pair occurs within the set of documents 100 can be an indication of the quality of the potential paraphrase pair. Each potential paraphrase pair can be ranked according to its frequency. The potential paraphrase pairs and their rankings can be stored for later use. A higher frequency can indicate a higher quality paraphrase pair and a lower frequency can indicate a lower quality paraphrase pair. For example, if a potential paraphrase pair “ripped/torn” is found eighty times within the set of documents 100, it is a higher quality paraphrase pair than a potential paraphrase pair “lost/won” that only appears six times within the set of documents 100.
In one implementation, the stored potential paraphrase pairs that exceed a minimum threshold quality level are considered higher quality paraphrase pairs and are provided to a user as suggestions for replacement in a phrase provided by the user. For example, the user can submit a search phrase to a Web search engine. The search engine can provide the user with suggestions for additional terms or phrases based upon the user's original search terms. Any term or phrase in the search term that is part of a higher quality paraphrase pair has an associated paraphrase member that can be provided to the user as a suggestion. The search engine may also order the suggestions based on the ranking of the higher quality paraphrase pairs contained in them. Alternatively, the search engine may automatically expand the search using the original search phrase and any other phrases generated by substituting one paraphrase member for the other paraphrase member of the higher quality paraphrase pair in the original search phrase.
FIG. 3 is a flow chart of an alternative process 300 that can be performed to identify potential paraphrase pairs. First, each ngram within a textual input is identified (step 302). Each identified ngram is stored in a first map (dictionary), where the keys are the identified ngrams and the value associated with the key is the number of times that the ngram appears within the textual input. The first map will contain as many keys are there are identified ngrams; duplicate ngrams are not stored in the first map. In one implementation, the first map can be created and stored on a single computer. In an alternative implementation, the first map can be created and stored across a distributed architecture of multiple computers. In this implementation, the process of creating and storing the first map is divided between multiple computers to reduce the amount of time required to create the first map. In another implementation, the process of creating and storing of the first map is divided among multiple computers using the MapReduce programming model. A description of the MapReduce programming model can be found in commonly owned U.S. patent application Ser. No. 11/204,922, filed Aug. 15, 2005, entitled “Scalable user clustering based on set similarity,” the entire disclosure of which regarding this programming model is incorporated by reference. The MapReduce programming model allows the tasks involved with the creation of the first map to be efficiently and effectively split across multiple computers.
The MapReduce process that creates the first map takes advantages of sentences from Web documents. Given the very large number of such sentences, the process benefits from the MapReduce model in that it transparently distributes the work across several computers. The input is a large set of Web documents. The Map phase splits the input into smaller subsets of documents that can be processed independently; these smaller subsets of documents can be allocated to different computers for faster processing. Within a Map task, the documents are processed sequentially by splitting them into sentences, and then identifying and issuing the corresponding ngrams from each sentence:
For each sentence, each ngram is issued from the Map phase to the Reduce phase as a pair of a key and a value, also referred to as a (key, value) pair. The key is the ngram itself. The value is the number of times the ngram has been identified in the sentence; the value is usually 1, but it is possible for the value to be greater than 1 for particular sentences. After the Map phase is completed, all of the (key, value) pairs that were issued are redistributed among the available computers; MapReduce ensures that all pairs with the same key issued from Map to Reduce will be distributed to the same task of the Reduce phase. In the Reduce phase, each group of (key, value) pairs from the Map phase that have the same key are identified, the corresponding values are summed, and a single (key, value) pair for the group of (key, value) pairs that have the same key is issued, where the (key, value) pair has the same key as the key of each of the (key, value) pairs, and the value is the summed values of the (key, value) pairs. These (key, value) pairs, in addition to each (key, value) pair that has a unique key, are the final output from the MapReduce. The value for any given key (ngram) is the number of times the key appears in the textual input. The first map of ngrams is stored across multiple computers, such that any given key (ngram) occurs only once within the entire map. In one implementation, only (key, value) pairs that have a value greater than a certain threshold value are issued as the final output from the MapReduce.
Using the ngrams stored in the first map, each anchor is identified for each ngram along with the middle portion associated with each anchor (step 304). A second map is created using the identified anchors, with the keys of the second map being each anchor, e.g., the concatenation of the beginning constant portion and the ending constant portion, and the values associated with the keys are the one or more middle portions found in the ngrams in between the beginning constant portion and ending constant portion of the anchor. When creating the second map, the input is the set of all (key, value) pairs from the first map. In each (key, value) pair, the key is the ngram and the value is the associated frequency count. The Map phase splits the input into smaller subsets of (key, value) pairs. Within a Map task, each subset of (key, value) pairs is processed sequentially. For each key, the ngram is split into its component words. The sequence of words is artificially divided into all possible combinations of a beginning constant portion, an ending constant portion, and the remaining middle portion. For each combination, the beginning constant portion is concatenated with the ending constant portion to form a new key. The new key is the anchor of the ngram. The new value is the remaining middle portion. The new (key, value) pair, consisting of the new key and the new value, is passed on to the Reduce phase. After the Map phase is completed, all of the (key, value) pairs that were issued are redistributed among the available computers; MapReduce ensures that all pairs with the same key issued from Map to Reduce will be distributed to the same task of the Reduce phase. The Reduce phase scans each group of (key, value) pairs from the Map phase that have the same key. The Reduce phase combines all the values (i.e., the various middle portions extracted for this key) into a new, concatenated value, and the Reduce phase issues the resulting (key, value) pair of the key and the concatenated value as output. Such (key, value) pairs are the final output from the MapReduce. In one implementation, the second map can be created and stored on a single computer. In an alternative implementation, the second map can be created and stored across a distributed architecture of multiple computers. In this implementation, the process of creating and storing the second map is divided between multiple computers to reduce the amount of time required to create the second map. In one implementation, the process of creating and storing of the second map is divided among multiple computers using the MapReduce programming model. The MapReduce programming model allows the tasks involved with the creation of the second map to be efficiently and effectively split across multiple computers. Each unique anchor will only have one key in the mapping; if more than one middle portion is associated with a unique anchor, all of the associated middle portions are stored as values for the key.
The middle portions stored in the second map are used to identify potential paraphrase pairs (step 306). A third map is created using the identified potential paraphrase pairs, with the keys of this third map being each potential paraphrase pair, and the values associated with the keys are the anchors associated with the potential paraphrase pair. During the Map phase, each value in the second map is split into a set of phrases, and all combinations of two phrases arranged in lexicographic order become keys of the third map. For example, if the second map contained two entries, the first entry having a key of anchor1 and a value of {phrase1, phrase2, phrase3}, the phrases being in lexical order, and the second entry having a key of anchor2 and a value of {phrase1, phrase3, phrase4} the phrases being in lexical order, six possible potential paraphrase pair combinations are generated: (phrase1,phrase2), (phrase1,phrase3), and (phrase2,phrase3), all of which are associated with anchor1; and (phrase1,phrase3), (phrase1,phrase4), and (phrase3,phrase4), all of which are associated with anchor2.
During the Reduce phase, each of these unique potential paraphrase pairs becomes a key of the third map, with the value for each unique potential paraphrase pair being the anchor or anchors associated with each potential paraphrase pair. Continuing the example above, the following five keys and values are stored in the third map: the key (phrase1,phrase2) with the value {anchor1}, the key (phrase1,phrase3) with the value {anchor1,anchor2}, the key (phrase1,phrase4) with the value {anchor2}, the key (phrase2,phrase3) with the value {anchor1}, and the key (phrase3,phrase4) with the value {anchor2}.
Each of the two elements of the potential paraphrase pair will be referred to as a paraphrase member of the potential paraphrase pair. Each anchor key in the second map that only has one associated middle portion value is ignored, as that middle portion has no potential corresponding member. Once the third map is created, the number of anchors in each value of the third map is also the number of times the potential paraphrase pair key associated with the value occurs in the second map. Therefore, using the third map, it is easy to identify the potential paraphrase pairs that occur in the most distinct contexts within the textual input.
Ordering of the paraphrase members within the potential paraphrase pair is unimportant; the potential paraphrase pairs “ripped/torn” and “torn/ripped” are equivalent, and this potential paraphrase pair will only appear in the third map once. This third map can be stored for later use and analysis, e.g., identifying potential paraphrase pairs that occur with greater frequency. In one implementation, the third map can be created and stored on a single computer, without using the MapReduce programming model as described above.
Embodiments of the invention and all of the functional operations described in this specification can be implemented in digital electronic circuitry, or in computer software, firmware, or hardware, including the structural means disclosed in this specification and structural equivalents thereof, or in combinations of them. Embodiments of the invention can be implemented as one or more computer program products, i.e., one or more computer programs tangibly embodied in an information carrier, e.g., in a machine-readable storage device or in a machine-readable propagated electromagnetic signal, for execution by, or to control the operation of, data processing apparatus, e.g., a programmable processor, a computer, or multiple processors or computers. A computer program (also known as a program, software, software application, or code) can be written in any form of programming language, including compiled or interpreted languages, and it can be deployed in any form, including as a stand alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A computer program does not necessarily correspond to a file. A program can be stored in a portion of a file that holds other programs or data, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files that store one or more modules, sub programs, or portions of code). A computer program can be deployed to be executed on one computer or on multiple computers at one site or distributed across multiple sites and interconnected by a communication network.
Processors suitable for the execution of a computer program include, by way of example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer. Generally, a processor will receive instructions and data from a read only memory or a random access memory or both. The essential elements of a computer are a processor for executing instructions and one or more memory devices for storing instructions and data. Generally, a computer will also include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto optical disks, or optical disks. However, a computer need not have such devices. Information carriers suitable for embodying computer program instructions and data include all forms of non volatile memory, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto optical disks; and CD ROM and DVD-ROM disks. The processor and the memory can be supplemented by, or incorporated in, special purpose logic circuitry.
To provide for interaction with a user, embodiments of the invention can be implemented on a computer having a display device, e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, for displaying information to the user and a keyboard and a pointing device, e.g., a mouse or a trackball, by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, speech, or tactile input.
Particular embodiments of the invention have been described. Other embodiments are within the scope of the following claims. For example, actions recited in the method claims can be performed in different orders and still achieve desirable results. In addition, actions can be performed in parallel. For example, ngrams can be compared while sentences are still being identified.

## Claims

1. A method comprising:
receiving textual input in data processing apparatus;
identifying, by operation of the data processing apparatus, a plurality of ngrams, each ngram being a sequence of words within the textual input;
dividing, by operation of the data processing apparatus, each identified ngram into three portions: a beginning constant portion containing a first number of words at the beginning of the ngram, an ending constant portion containing a second number of words at the end of the ngram, and a middle portion containing the words of the ngram between the beginning constant portion and the ending constant portion;
determining, by operation of the data processing apparatus, an anchor for each ngram, the anchor comprising the beginning constant portion and the ending constant portion of the ngram; and
identifying, by operation of the data processing apparatus, a plurality of potential paraphrase pairs, wherein if the anchor of a first ngram is the same as the anchor of a second ngram in the plurality of ngrams, the middle portion of the first ngram and the middle portion of the second ngram is identified as being a potential paraphrase pair, wherein the middle portion of the first ngram is textually different from the middle portion of the second ngram.

2. The method of claim 1, wherein determining the anchor comprises including a named entity as part of the anchor.

3. The method of claim 2, wherein the anchor further comprises a remainder of an adverbial relative clause modifying the named entity.

4. The method of claim 3, further comprising:
counting the number of unique anchors associated with each identified potential paraphrase pair to determine the quality of each potential paraphrase pair; and
identifying potential paraphrase pairs that are associated with a larger number of anchors as being of higher quality than potential paraphrase pairs that are associated with a smaller number of anchors.

5. The method of claim 2, further comprising:
counting the number of unique anchors associated with each identified potential paraphrase pair to determine the quality of each potential paraphrase pair; and
identifying potential paraphrase pairs that are associated with a larger number of anchors as being of higher quality than potential paraphrase pairs that are associated with a smaller number of anchors.

6. The method of claim 1, further comprising:
counting the number of unique anchors associated with each identified potential paraphrase pair to determine the quality of each potential paraphrase pair; and
identifying potential paraphrase pairs that are associated with a larger number of anchors as being of higher quality than potential paraphrase pairs that are associated with a smaller number of anchors.

7. The method of claim 6, further comprising:
identifying each potential paraphrase pair as being a higher quality paraphrase pair if the number of unique anchors associated with the potential paraphrase pair is equal to or greater than a threshold value.

8. The method of claim 7, further comprising:
receiving a term, the term being a sequence of one or more words;
identifying one or more higher quality paraphrase pairs in each of which the term is identical to a paraphrase member; and
adding the non-identical paraphrase member of each identified higher quality paraphrase pair to a set of suggested alternatives for the term.

9. The method of claim 1, wherein each ngram has between seven and ten words.

10. The method of claim 1, wherein the first number of words is three words, and the second number of words is three words.

11. The method of claim 1, further comprising:
identifying one or more sentences in the textual input, wherein each identified ngram is a sequence of one or more words within an identified sentence.

12. A computer program product, encoded on a computer readable medium, operable to cause data processing apparatus to perform operations comprising:
receiving textual input;
identifying a plurality of ngrams, each ngram being a sequence of words within the textual input;
dividing each identified ngram into three portions: a beginning constant portion containing a first number of words at the beginning of the ngram, an ending constant portion containing a second number of words at the end of the ngram, and a middle portion containing the words of the ngram between the beginning constant portion and the ending constant portion;
determining an anchor for each ngram, the anchor comprising the beginning constant portion and the ending constant portion of the ngram; and
identifying a plurality of potential paraphrase pairs, wherein if the anchor of a first ngram is the same as the anchor of a second ngram in the plurality of ngrams, the middle portion of the first ngram and the middle portion of the second ngram is identified as being a potential paraphrase pair, wherein the middle portion of the first ngram is textually different from the middle portion of the second ngram.

13. A system comprising:
one or more computers;
where the one or more computers are configured to perform operations comprising:
receiving textual input;
identifying a plurality of ngrams, each ngram being a sequence of words within the textual input;
dividing each identified ngram into three portions: a beginning constant portion containing a first number of words at the beginning of the ngram, an ending constant portion containing a second number of words at the end of the ngram, and a middle portion containing the words of the ngram between the beginning constant portion and the ending constant portion;
determining an anchor for each ngram, the anchor comprising the beginning constant portion and the ending constant portion of the ngram;
identifying a plurality of potential paraphrase pairs, wherein if the anchor of a first ngram is the same as the anchor of a second ngram in the plurality of ngrams, the middle portion of the first ngram and the middle portion of the second ngram is identified as being a potential paraphrase pair, wherein the middle portion of the first ngram is textually different from the middle portion of the second ngram;
receiving a query entered as an input in a search engine by a user;
identifying one or more suggestions, each suggestion being an alternative term for replacing a sequence of one or more words in the query, where the sequence is one paraphrase member of a potential paraphrase pair and the suggestion is the other paraphrase member of the potential paraphrase pair; and
generating one or more alternative queries using the one or more suggestions.

14. The system of claim 13, wherein the operations further comprise:
counting the number of times each identified potential paraphrase pair occurs in a set of documents; and
determining rankings for the identified potential paraphrase pairs according to the number of times each identified potential paraphrase pair occurs in the set of documents.

15. The system of claim 13, wherein determining the anchor comprises including a named entity as part of the anchor.

16. The system of claim 15, wherein the anchor further comprises a remainder of an adverbial relative clause modifying the named entity.

17. The system of claim 16, the operations further comprising:
counting the number of unique anchors associated with each identified potential paraphrase pair to determine the quality of each potential paraphrase pair; and
identifying potential paraphrase pairs that are associated with a larger number of anchors as being of higher quality than potential paraphrase pairs that are associated with a smaller number of anchors.

18. The system of claim 15, the operations further comprising:
counting the number of unique anchors associated with each identified potential paraphrase pair to determine the quality of each potential paraphrase pair; and
identifying potential paraphrase pairs that are associated with a larger number of anchors as being of higher quality than potential paraphrase pairs that are associated with a smaller number of anchors.

19. The system of claim 13, the operations further comprising:
identifying one or more sentences in the textual input, wherein each identified ngram is a sequence of one or more words within an identified sentence.

20. The system of claim 13, the operations further comprising:
counting the number of unique anchors associated with each identified potential paraphrase pair to determine the quality of each potential paraphrase pair; and
identifying potential paraphrase pairs that are associated with a larger number of anchors as being of higher quality than potential paraphrase pairs that are associated with a smaller number of anchors.

21. The system of claim 20, the operations further comprising:
identifying each potential paraphrase pair as being a higher quality paraphrase pair if the number of unique anchors associated with the potential paraphrase pair is equal to or greater that a threshold value.

22. The system of claim 21, the operations further comprising:
receiving a term, the term being a sequence of one or more words;
identifying one or more higher quality paraphrase pairs in each of which the term is identical to a paraphrase member; and
adding the non-identical paraphrase member of each identified higher quality paraphrase pair to a set of suggested alternatives for the term.

23. The system of claim 13, wherein each ngram has between seven and ten words.

24. The system of claim 13, wherein the first number of words is three words, and the second number of words is three words.