---
title: "New Tools for Web-Scale N-grams — paper by Lin et al. (2010)"
description: "How New Tools for Web-Scale N-grams makes billions of word-sequence counts searchable by grammar and uses their contexts to group phrases."
canonical: "https://research.elamur.ai/free/en/papers/lin-2010-new-tools-web-scale-n/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/lin-2010-new-tools-web-scale-n/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2010](https://md.research.elamur.ai/free/en/papers/2010/) / New Tools for Web-Scale N-grams

# New Tools for Web-Scale N-grams

Paper · 2010 · Dekang Lin, Kenneth Church, Heng Ji et al.

**Authors:** [Dekang Lin](https://md.research.elamur.ai/free/en/authors/dekang-lin/), [Kenneth Church](https://md.research.elamur.ai/free/en/authors/kenneth-church/), [Heng Ji](https://md.research.elamur.ai/free/en/authors/heng-ji/), [Satoshi Sekine](https://md.research.elamur.ai/free/en/authors/satoshi-sekine/), [David Yarowsky](https://md.research.elamur.ai/free/en/authors/david-yarowsky/), [Shane Bergsma](https://md.research.elamur.ai/free/en/authors/shane-bergsma/), [Kailash Patil](https://md.research.elamur.ai/free/en/authors/kailash-patil/), [Emily Pitler](https://md.research.elamur.ai/free/en/authors/emily-pitler/), Rachel Lathbury, [Vikram Rao](https://md.research.elamur.ai/free/en/authors/vikram-rao/), Kapil Dalwani and Sushant Narsale · **Year:** 2010 · **Venue:** Proceedings of the Seventh International Conference on Language Resources and Evaluation (LREC'10) · **Licence:** [CC BY-NC 4.0 (ELRA, LREC proceedings)](https://creativecommons.org/licenses/by-nc/4.0/)

[**74** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2154507487) · [Proceedings of the Seventh International Conference on Language Resources and Evaluation (LREC'10)](https://aclanthology.org/volumes/L10-1/) · [licence](https://creativecommons.org/licenses/by-nc/4.0/)

- [Publisher's page](https://aclanthology.org/L10-1158/)
- [PDF](https://aclanthology.org/L10-1158.pdf)
- [DOI 10.63317/44fpr4ygd2xg](https://doi.org/10.63317/44fpr4ygd2xg)
- [OpenAlex](https://openalex.org/W2154507487)

Citations: OpenAlex, 2026-10-14.

## Summary

A short phrase can be easy to find on the web and hard to count in the sense a researcher needs. A search for *many water*, for example, can turn up *many water bottles*, where *many* applies to *bottles*. Those occurrences give little evidence about how speakers use *water* by itself. Running a few searches and inspecting the results can help with a particular example. Building a lexical resource from such evidence means repeating the process across a vocabulary, where both the cost of searching and the quality of the matches matter. “New Tools for Web-Scale N-grams” treats these as related problems. It organizes recurring sequences into an [n-gram](https://md.research.elamur.ai/free/en/concepts/n-gram/) corpus and makes grammatical annotations available at search time.

The authors build their main tools around a collection of 4.1 billion n-grams drawn from the source text of the earlier Google counts. They remove duplicate sentences, filter and normalize the text, and apply [part-of-speech tagging](https://md.research.elamur.ai/free/en/concepts/part-of-speech-tagging/) to label words by their grammatical use in context. The resulting records preserve both the overall frequency of a sequence and its frequencies under different tag sequences. The main search tool stores rearranged copies of each sequence so that a word or phrase of interest can serve as a lookup key wherever it originally appeared. A researcher can retrieve the resulting block, test the surrounding words and tags, and collect counts. The same pattern machinery can run over the full collection when the goal is broad coverage.

The paper also describes two indexes for different kinds of work. A suffix-array index serves straightforward frequency queries and can return the highest-count matches to broad searches. A separate index over annotated Wikipedia accepts conditions on grammatical categories, phrase chunks, and named entities. It also returns source occurrences, so a researcher can inspect the sentences behind a count. In one example, asking for a company and a numerical expression in specified positions halves the number of matching n-grams returned by a broader query. The Wikipedia index takes 500GB, compared with 2.4TB for the earlier trie-based design, with a small reported cost in search speed.

The largest application in the paper uses neighboring words to group 10 million phrases into 1000 clusters. Longer n-grams provide evidence about where shorter phrases occur. The resulting groups include car names, expressions for agreements, and personal names with similar surroundings. The authors also report a downstream improvement over co-occurrence frequencies on a conjunction-scope task, though they give no numerical task scores. The demonstrations show what becomes possible when searches can distinguish grammatical conditions and collect local context at scale. An example from the suffix-array application shows the other side of that dependence on annotation. A tagging error repeated throughout the corpus can become strong evidence for the wrong analysis.

## Deep dive: New Tools for Web-Scale N-grams

How New Tools for Web-Scale N-grams makes billions of word-sequence counts searchable by grammar and uses their contexts to group phrases. · about 36 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Getting the right count

Suppose a researcher wants evidence that a particular noun is normally countable. Uses with *many* can help, as can uses with *much*, provided that the modifier governs the noun being studied. The string alone may leave that relationship unclear. In *many water bottles*, the word immediately after *many* is *water*. The word that makes the expression plural and countable is *bottles*. If the search ends at *water*, the result can look like evidence for a grammatical use that the longer sequence would have ruled out. Looking one word farther and considering its grammatical category changes the interpretation of the count.

This problem also arises with names. In one example in the paper, a query for *Martin Luther* can include occurrences in *Martin Luther King Jr. Boulevard*. A researcher may want occurrences of the shorter name as a unit. A query for an initial string gathers instances of that string in longer expressions as well. The distinction matters whenever the statistic will be attached to the shorter expression and used elsewhere. A retrieval system that can express conditions at the edges of a match gives the researcher some control over which evidence enters that statistic.

The question of scale is separate. A count for a particular expression might require little work. Producing a collection of grammatical or semantic properties for many expressions calls for many searches, and each search may generate material that needs inspection or post-processing. The paper invokes work on large corpora for language disambiguation to explain why expanding the available evidence was worth pursuing. It also situates the project in research that treated the web as a corpus for a range of language tasks. The aim here is to let researchers use the resulting evidence without having to collect and process all the web documents themselves. [Scaling to Very Very Large Corpora for Natural Language Disambiguation](https://md.research.elamur.ai/free/en/papers/banko-2001-scaling-very-very-large-corpora/), [Introduction to the Special Issue on the Web as Corpus](https://md.research.elamur.ai/free/en/papers/kilgarriff-2003-introduction-special-issue-web-as/)

#### What earlier approaches offered

Broad web search had a clear role in earlier work. A researcher could ask for expressions whose frequencies were missing from a smaller corpus and use the results as evidence. The authors describe such searches as practical when the number of queries is small. They see a different situation when a project needs millions of queries, for example to collect examples of named-entity types or to discover groups of words with similar uses. A general-purpose search interface also offered little control over conditions such as punctuation, capitalization, and grammatical tags. The frequency sought by the researcher could depend on precisely those details. [Using the Web to Obtain Frequencies for Unseen Bigrams](https://md.research.elamur.ai/free/en/papers/keller-2003-web-obtain-frequencies-unseen-bigrams/)

Another approach was to retrieve pages with a search engine and run a language-processing step on the returned text. That gives the researcher more freedom to define a match after retrieval. It also gives each query an additional processing cost, which the authors describe as practical only on a small scale. Systems designed to support linguistic queries offered another alternative. The paper describes their document collections as smaller than those of broad commercial engines. At the scale the authors wanted, the choice of collection and the expressiveness of the query were both central constraints. [Open Information Extraction from the Web](https://md.research.elamur.ai/free/en/papers/banko-2007-open-information-extraction-web/)

An n-gram corpus makes a different kind of evidence available. An n-gram is a contiguous sequence of tokens, where a token is a unit of text such as a word or a punctuation mark. Many occurrences of the same sequence can share one record with a frequency. A maximum sequence length bounds the amount of context each record can represent, and a frequency cutoff can remove rare records. The earlier Google corpus that the authors discuss used a trillion words of online text. Its published counts occupied roughly 24 GB compressed and were distributed across hundreds of files. A resource can be much smaller than its source documents and still require specialized access when the analysis calls for repeated lookups.

The paper describes several approaches to that access problem. A program can sort a collection of queries in advance to reduce passes through the data. It can use hashing or a database to find stored entries, or it can use a trie, a structure that groups keys by shared prefixes. These approaches make it easier to retrieve the information the counts contain. The older Google records provide words and frequencies. A faster lookup can answer how often a sequence appears in those records, while a breakdown by grammatical use requires additional information in the records themselves.

Noun countability makes the implications of that difference concrete. Earlier corpus work described by the authors used grammatical tags to help locate the boundary of a noun phrase. That boundary tells the researcher which complete expression went with the modifier, even when the same opening words occur in many longer expressions. The paper says the web-search approaches it discusses had to leave that issue aside and reported weaker performance. This motivates a corpus that combines broad coverage with a search language able to use boundary evidence. [Learning the Countability of English Nouns from Corpus Data](https://md.research.elamur.ai/free/en/papers/baldwin-2003-learning-countability-english-nouns-corpus/)

#### Why phrases and their surroundings matter

The authors also wanted a resource that could help a system make decisions about words or phrases that had been absent from its labeled training examples. A phrase can inherit evidence from other phrases that behave similarly. If a system learns something about a familiar car name, for example, it may be able to use that information for a new name assigned to the same cluster. The practical question is how to discover those groups in text on a scale large enough to cover expressions beyond the labeled data.

Earlier studies cited in the paper had used word clusters to support supervised tasks. The Brown clustering approach that the authors discuss works with words. A word can participate in expressions with very different meanings. *Accord* occurs in both *Honda Accord* and *peace accord*, for instance, so features for the isolated word can mix evidence that the phrases would keep apart. The earlier work the paper cites provides precedents for using clusters in name tagging and [dependency parsing](https://md.research.elamur.ai/free/en/concepts/dependency-parsing/). The present project is concerned with obtaining clusters whose members can be phrases. [Name Tagging with Word Clusters and Discriminative Training](https://md.research.elamur.ai/free/en/papers/miller-2004-name-tagging-word-clusters-discriminative/), [Simple Semi-supervised Dependency Parsing](https://md.research.elamur.ai/free/en/papers/koo-2008-simple-semi-supervised-dependency-parsing/)

The closest predecessor described for that part of the project grouped phrases using K-means and used search queries to help decide which sequences counted as phrases. The authors point out that both the underlying web documents and the resulting clusters from that work were unavailable publicly, and that search-query data were also unavailable. Their own approach makes the decision about phrase candidates from the corpus itself. It asks whether a sequence can occur in sufficiently varied contexts and then uses those contexts to describe it. That makes the corpus serve both as a source of candidates and as a source of evidence for grouping them. [Phrase Clustering for Discriminative Learning](https://md.research.elamur.ai/free/en/papers/lin-2009-phrase-clustering-discriminative-learning/)

### The method, step by step

#### Build counts that preserve grammatical alternatives

The main web collection starts from the same source text as the earlier Google n-grams. The authors first discard duplicate sentences. They note that boilerplate such as legal notices can recur millions of times on the web. A count that includes each duplicate in such a collection can give disproportionate weight to language from a repeatedly copied sentence. Deduplication changes the counting population before any sequence frequencies are calculated.

The authors then keep sentences 20 to 300 bytes long whose digits and punctuation account for less than 20% of their characters. These rules are intended to remove low-quality text. They replace digits with `0` and substitute shared markers for URLs and email addresses. Accordingly, strings that differ only in their digits can contribute to the same normalized record. This is why digit-bearing expressions in the clustering examples can contain strings of zeros.

Each remaining sentence receives grammatical tags from the TnT tagger using the categories of the [Penn Treebank](https://md.research.elamur.ai/free/en/papers/marcus-1993-building-large-annotated-corpus-english/). The tagging takes place while the words still have sentence context. The counts are then collected over the annotated material. The authors retain unigrams occurring more than 40 times and sequences of 2 to 5 tokens occurring more than 10 times. The resource therefore contains a filtered set of surface sequences, together with the counts of each tag sequence associated with them. [TnT](https://md.research.elamur.ai/free/en/papers/brants-2000-tnt-statistical-part-speech-tagger/)

The record for *flies* shows what this adds to a frequency lookup. It has a total of 1,643,568, with 611,646 assigned the tag NNS and 1,031,922 assigned VBZ. NNS is the plural-noun tag. VBZ is the tag for a third-person singular present-tense verb. An analysis that needs an estimate of verbal uses can ask about that grammatical reading within the record, in addition to using the total if it needs the overall prevalence of the word. The same principle applies to longer entries. Their tag information describes different grammatical sequences assigned to occurrences of the same words.

Here, [linguistic annotation](https://md.research.elamur.ai/free/en/concepts/annotation/) adds a layer to the data that the index can preserve and the query can test. The annotator makes its decisions before aggregation, and every retained decision contributes to the breakdown recorded for that sequence. A later search can use the variation that remains visible there. It also inherits errors made during tagging. There is no new sentence-level tagging step each time someone requests a count.

Preparing and searching the rotated web n-grams The steps in order.

#### Turn an interior word into an index key

The main search tool uses rotation to solve a problem with alphabetical order. If records are sorted in their ordinary word order, sequences starting with *cheetah* appear together. Sequences containing that word later are scattered according to how they begin. A researcher interested in the surroundings of *cheetah* would have to look in many places. The authors arrange the data so that the word can instead appear at the front of an index key even when it is near the end of the source sequence.

For a sequence with words to the left of the chosen starting position, the rotated record begins at that position and continues to the original end. A marker follows. Then the words originally on the left appear in reverse order. With the paper’s cheetah example, the rotation that starts at *cheetah* places *a* immediately after the marker, followed by *than* and *faster*. With *than* as the starting position, the words from *than* through *cheetah* occupy the opening of the record, and *faster* follows the marker. The original ordering is available from the two parts. The count and tag data travel with the record.

The reverse order on the left has a practical consequence. The nearest left neighbor is the first word on that side of the marker. A single scan of the records keyed by a candidate phrase can therefore collect information about nearby words on both sides. If the candidate begins the original sequence, some records show right extensions in ordinary order. If it appears after a left neighbor, the alternative record can expose that neighbor immediately after the marker. Rotation is thus useful both for finding the relevant block and for reading its local context.

After rotation, the authors sort the records alphabetically and divide them into 992 files of approximately 500MB each when uncompressed. The layout keeps a search prefix within a single file. An index identifies the location of the corresponding block, so the program can move directly to that part of the file. A prefix can be a word or a sequence of tokens up to the length supported by the data. A phrase used as a prefix begins the relevant rotated records, even when words originally preceded it.

The rotated copies are alternate views of the same counted sequence. Each copy represents access at a different starting position. The intended statistic determines which access positions are relevant. A request for a particular phrase and its left neighbors uses the blocks where that phrase starts the view. The frequencies accompanying those records still refer to the counted source sequence and the associated tags.

#### Filter the retrieved block and decide what to collect

The search prefix is a way to narrow the set of records to inspect. A pattern specifies which of those records matter. The two jobs can have very different requirements. A researcher may have a rare word that makes an effective lookup key and a longer grammatical condition that specifies which uses of that word count as evidence. The index handles the lookup. The matcher checks the additional words and tags once the records have been found.

The pattern language uses nested, parenthesized expressions. An elementary condition can test a word for equality, ask whether a tag belongs to a list, or compare a word or tag with a regular expression. A regular expression specifies a family of matching strings. Applied to tags, it can describe a category by its initial characters. Applied to sequences, it can let some words vary while keeping others fixed. The paper illustrates this with a pattern that allows a variable gift in an expression about receiving something for Christmas.

Larger patterns combine these conditions. An alternative can accept any member of a specified set of patterns. A sequence requires consecutive matches in the designated order. The language can also make part of a pattern optional or require a pattern to match repeated consecutive subsequences. These operations let one query cover variants of the same construction while still imposing a grammatical condition at the point that matters.

Consider a search for *a river* followed by a tag outside the noun category. A sequence with the next word tagged as a verb supplies the kind of boundary evidence the authors want. When the next word is a noun, as in *a river boat*, the match ending at *river* fails that condition. This is a local test at the edge of the phrase. The search expresses the evidence it needs in terms of nearby tags and can apply the same test to every retrieved record.

A matching command determines the output. One command can print the n-grams that passed, optionally limiting the output to a specified number of matches. Another can aggregate counts for selected portions of each match. The pattern can give names to those portions, and the output format can pick out the named pieces. This makes it possible to collect a small record about a lexical property from many different longer sequences. The stored frequencies tell the program how frequently the matching sequences occurred, so the requested output can represent corpus occurrences as well as the distinct sequence types that supplied them.

The paper illustrates this with patterns for animacy, the distinction between animate and inanimate referents. A pattern can select a run of nouns and adjectives, allow an intervening comma, and record which relative pronoun comes next. The extracted statistics associate phrases with pronouns such as *who* and *which*. Repeated use with *who* can serve as evidence for an animate interpretation. Similar patterns were used to gather evidence about grammatical gender and number. The output describes tendencies across uses, which another application can consult when it encounters a possible person mention.

The countability pattern makes a different part of the match do the work. It recognizes *much* or *many*, gathers the noun and adjective sequence that follows, and tests the tag after that sequence for a noun boundary. The extracted fields pair the modifier with the phrase that occurs with it. A longer expression containing *water* can therefore contribute evidence to the longer phrase when that is what the pattern identifies. The method depends on the chosen tag constraints to approximate where the relevant phrase ends.

#### Choose between targeted lookup and a full pass

The targeted tool, called `search_prefix`, accepts a prefix and an index. The index can be loaded from disk or accessed through a running server. The tool can also apply one or more commands to the block it returns. Several commands can process the same block together. This is useful when the researcher has a set of patterns that need related evidence from the same lexical starting point.

Targeted lookup fits investigations in which the expressions are known in advance. For a tagging experiment, these might be expressions appearing in annotated training and test examples. The program can instantiate patterns for that vocabulary and retrieve the relevant blocks. The authors use this approach for the distinction between a past-tense verb, tagged VBD, and a past participle, tagged VBN. For a phrase such as *lessons learned*, they look elsewhere in the collection for uses where *learned* occurs before a determiner or possessive followed by *lessons*. Those sequences provide evidence that *lessons* can be the object of *learned*, which supports a participial reading when the words occur in the reverse order in the target phrase.

The paper compares that evidence with the corresponding search for *students learned*. The frequencies for constructions with *students* in the potential object position are lower. This is a specific kind of lexical evidence about the relationship between a verb and noun. It supplements the original tagging decision with evidence drawn from other occurrences. The paper uses the example to explain the lookup procedure and the intended disambiguation, without specifying a numerical decision threshold.

When a pattern contains several fixed expressions, the authors choose the longest available phrase as the prefix. If candidates tie in length, they choose the one whose opening token has the lower unigram count. The target quantity is the size of the block the program will have to process. The unigram count is an accessible approximation, and the longer phrase is intended to constrain the search further. A very common prefix can leave the matcher substantial work even after the indexed lookup succeeds.

A batch job starts from a different question. If the goal is a lexical resource that can later serve many tasks, the set of phrases can be discovered during processing. The program applies a pattern to the rotated data across the files and collects the matches. Those files can be distributed among workers. The authors used Hadoop on the IBM/Google academic computing cluster for such processing. They used the batch approach for properties such as gender, number, and animacy, where collecting the available evidence broadly was part of the purpose.

#### Discover phrase candidates from their neighbors

The clustering application begins with candidate selection. An expression can be frequent because it almost always forms the beginning of a longer one. The paper illustrates this with *degree in computer*, which is common as a fragment, and *degree in computer science*, which the authors treat as a phrase. A frequency threshold can ensure that there is enough evidence to consider a sequence. It gives little information about whether that sequence is usable as a unit.

The authors look instead for diversity in the immediate surroundings of a candidate. Their idea is that a sequence confined to a few left or right contexts has low contextual entropy. Entropy describes how concentrated or spread a distribution is. If nearly every continuation belongs to a small family, that dependence is evidence that the candidate may typically be part of something longer. An expression that occurs as a unit has more opportunity to appear beside different words as it takes on different roles in text.

The implementation approximates this criterion with filters. It requires variety among the distinct contexts on both sides and a certain share of contexts made up of stop words, meaning the common words the procedure designates for that purpose. It also inspects the candidate itself. Among the constraints described, the phrase cannot begin with a stop word or end with a conjunction, preposition, or determiner, and some punctuation is excluded. These conditions are operational choices for selecting candidates from counts. The paper describes tuning them through development clusterings and inspecting the results.

#### Represent each phrase by its surrounding words

The next step uses the [distributional semantics](https://md.research.elamur.ai/free/en/concepts/distributional-semantics/) idea that expressions with similar usage contexts tend to have related meanings. A phrase’s context is represented by features derived from longer n-grams containing it. The same neighboring word can be a different feature depending on whether it occurs to the left or the right. The authors consider words directly next to the phrase as well as words with a stop word between them and the phrase. This extends the context that can contribute while keeping the features local to the phrase.

The paper follows a block for *degree in engineering*. Within that block, 31,978 is the count of the phrase itself. A longer sequence offers a count of 110 for the left context *PhD*, and another offers 21 for *accredited* on the left. On the right, the examples include *mechanics* with 63 and *management* with 63. The positions matter. The vector can distinguish a word used before the phrase from the same word used as a continuation. It describes an observed environment for the phrase, with many different neighbors potentially contributing.

The rotated layout lets the authors choose phrases and gather their context counts during the same pass. In the distributed computation, the mapping stage builds a vector of context counts for each example. The reducing stage sums the frequencies for each context across the examples. This global tally is needed because a neighboring word can be widespread. Its occurrence beside a phrase is more informative when considered alongside how often the context appears elsewhere and how often the phrase itself occurs.

A further pass turns the raw counts into the association weights used for clustering. The authors describe the transformation as mutual-information weighting and specify it as division by the phrase frequency and the global context frequency. Written directly as the calculation they describe, it is

```
A(p, c) = C(p, c) / (F(p) × G(c))
```

Here, `p` is a candidate phrase and `c` is a context feature, including the relevant side of the phrase. `A(p, c)` is the resulting association weight. `C(p, c)` is the count for the phrase and feature together, `F(p)` is the phrase’s frequency, and `G(c)` is the frequency of that feature summed across the examples. The slash denotes division, the multiplication sign combines the denominators, and the parentheses mark the arguments of each quantity or group the product. The paper describes this count transformation without giving a logarithmic calculation.

The adjustment lets phrases be compared through what is characteristic about their context profiles. A large raw count can result from the phrase being frequent, the neighboring word being frequent, or the two occurring together disproportionately often. The stated weighting takes both overall frequencies into account. The resulting vector has a coordinate for each context feature and a value representing the corresponding association.

#### Group the context profiles

The authors use K-means to group the phrase vectors. In this procedure, each group is represented by a centroid, a vector that summarizes the group. Starting from a random initialization, the procedure repeatedly groups examples around their representatives and updates those representatives. The paper describes assigning similarity through cosine similarity. This compares the direction of two vectors. If two phrases put similar relative weight on the same neighbors, their profiles can be similar even when the original phrase counts are quite different.

```
cos(u, v) = (u · v) / (‖u‖ × ‖v‖)
```

In this expression, `u` and `v` are the two feature vectors being compared, for instance a phrase vector and a centroid. `cos(u, v)` is their cosine similarity. The dot denotes the sum of products of corresponding coordinates, and the double bars give each vector’s Euclidean length. The slash divides the dot product by the product of the two lengths, denoted by the multiplication sign. The parentheses around the dot product group the numerator.

The authors chose K-means because it was computationally practical and could be parallelized. The reported run used 50 iterations and 1000 cluster centroids with random initialization. Their account gives the data flow from candidate selection to context weighting and clustering, with development runs used to set the selection thresholds. The paper makes the phrase clusters publicly available and identifies `ngramtools` as the planned open-source release for the tools.

#### Use suffix arrays for simple or ranked queries

A separate set of tools starts from flat files that associate sequence keys with frequencies and grammatical tags. A suffix is the part of a sequence beginning at a given position and continuing to its end. A suffix array provides a sorted index of starting positions. Sorting by what follows each position puts occurrences with the same opening text together in the index. This is useful for finding keys that contain a queried expression, including when that expression begins somewhere inside the key.

The authors divide the flat files into chunks of roughly 2GBs and build an index for each chunk. They choose the size so that random access within a chunk is feasible. At search time, the tool supports exact equality, starts-with matches, and matches in which the query occurs within the n-gram. These conditions answer different questions. The count of an exact expression can be looked up directly, while a contains search can expose longer sequences associated with it.

A modified suffix array can also return the top K matches by stored frequency. Here, K is the number of ranked results requested. A broad query may match many records. Returning the most frequent ones gives the researcher a bounded result ordered by a clearly specified quantity. The usefulness of this mode depends on that quantity fitting the task. For an inventory of all matching patterns, lower-frequency records can still matter. For quickly examining common examples, a count-ranked result may suffice.

The paper describes the suffix-array tools as the fastest option among its tools for exact frequency lookups and as efficient for top-K retrieval. Their character is different from the full pattern processing used with rotations. The starting point is a key lookup against a flat file. The same approach can be applied to other outputs organized as flat files. The authors applied it to their clustering output as well as to records of automatically discovered units from Switchboard speech.

#### Keep source occurrences searchable in Wikipedia

The Wikipedia tool uses a separate corpus and keeps more annotation. It uses parts of speech and also represents local word groups, including noun phrases, verb phrases, and prepositional phrases, through syntactic chunks. It also uses [named-entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/) to label mentions of people, places, and organizations. The OAK system supplies the part-of-speech and chunk tags, and the Stanford named-entity tagger supplies the entity labels. The authors extract sequences up to seven tokens long and apply no frequency threshold to the resulting n-grams.

The system accepts wildcard positions. A wildcard allows the text at a position to vary. A condition on that wildcard can require a grammatical tag, chunk type, or named-entity category. For a query involving *was established in*, the researcher can therefore ask that the material before the fixed phrase be a company and that the material afterward carry the cardinal-number tag. These constraints use information already attached to the indexed text.

The tool builds an [inverted index](https://md.research.elamur.ai/free/en/concepts/inverted-index/), which provides a route from indexed items to the positions where they appear. The system also uses checking mechanisms to enforce query conditions. The paper describes this as a redesign of the earlier trie-based tool and points to a separate account for details of the indexing and checking algorithms. The interface returns the matching n-grams and their frequencies, with their source sentences, keyword-in-context views, and document identifiers. A user can therefore follow an aggregated result back to the occurrences that support it and see whether the annotation-based restriction performed as intended.

### Experiments and results

#### Two collections with different counting rules

The paper reports the scale of each collection, illustrates searches over them, and describes applications that consume the results. The measurements belong to particular stages of that work. Corpus sizes count retained sequences. The index comparison concerns disk space and search speed. The clustering output counts the phrases and groups produced. Only some of the application examples describe downstream comparisons, and those accounts give direction of performance without reporting a full set of scores.

The two main collections come from different sources and use different inclusion rules. The web resource used by the rotated and suffix-array tools contains 4.1 billion n-grams after filtering sentences and dropping low-frequency sequences. The Wikipedia corpus contains 1.7 billion tokens, and its indexed collection contains 4.55 billion unique n-grams. The Wikipedia extraction retains sequences up to seven tokens long at any observed frequency. The chart compares the size of the outputs under those respective settings. The star identifies the Wikipedia setting highlighted in the index and query demonstrations.

Distinct n-gram counts for the web and Wikipedia corpus settings The Wikipedia extraction retains more distinct sequences under its own length and frequency rules.

**The numbers**

| System or setting | billion distinct n-grams |
| --- | --- |
| Tagged web corpus with frequency cutoffs | 4.1 |
| Annotated Wikipedia without a frequency cutoff (this paper) | 4.55 |

Here, a higher value describes the number of entries available for lookup in that collection. The quantities combine differences in source text, maximum sequence length, and filtering. They do not isolate the effect of annotation or measure the quality of the available evidence. They do show why both projects needed an index. Even a collection built from repeated local sequences has billions of distinct keys under these settings.

The paper gives 96.7% on the Treebank as the accuracy figure associated with TnT and cites accuracy and efficiency as reasons for choosing the tagger. That figure concerns tagging on the Treebank. The paper does not report a corresponding accuracy estimate on the cleaned web sentences. The example for *flies* is a count breakdown over the resulting automatically assigned tags. It illustrates the format of the corpus records while leaving open how accurately the tags divide the web uses of that word.

#### Query restrictions and the Wikipedia index

The Wikipedia query demonstration compares a pattern with open slots around *was established in* with one that asks for a company and a cardinal-number tag in those slots. The authors report that the narrower query halves the number of matching n-grams. They describe specific unwanted matches removed by the restriction. Punctuation and common nouns in the initial position, and location names in the later position, can satisfy the broader token pattern. The added choices make the returned set better aligned with a search for a company associated with a numerical expression.

The metric in this example is how many distinct matching n-grams the query returns. An occurrence can be discarded because it fails the imposed type condition, which is what allows the output to shrink. The result gives a practical illustration of selectivity. Establishing precision would require assessing which returned occurrences actually express the intended relationship. Establishing recall would also require identifying relevant occurrences lost because of the wording or tags. The paper supplies examples of filtering and the change in result size.

For the index itself, the earlier trie design is the storage baseline. The reported size falls from 2.4TB for that design to 500GB for the inverted-index implementation. The authors describe the speed cost of the change as minor. They also report that a search with the newer tool takes a fraction of a second on a Linux PC using a single CPU, 1GB of memory, and 500GB of disk. The hardware and storage figures characterize that implementation. The paper gives no distribution of query latencies or matched workload comparing all its search tools.

The suffix-array tool is evaluated in a different way. The authors describe its relative strengths for exact queries and count-ranked retrieval. The tagger built on top of it serves as a test of what happens when the indexed statistics become evidence for a language decision. In *He drove to work*, the tool’s tagger labeled *work* as a verb. The authors trace this to errors already present in the annotated input. The example identifies a mechanism that can cause a wrong result even when the index faithfully serves the stored counts.

#### What the phrase clusters contain

The clustering run yields 10 million phrases in 1000 clusters. Those numbers describe the extent of the released resource. To assess the resulting groups in this paper, the authors show phrases close to selected centroids alongside context features with high weight. Reading the phrases and the features together helps explain what kind of similarity the procedure captured. A centroid is expressed in the same contextual terms as the phrase vectors that gave rise to it.

Cluster 825 includes *Nissan Maxima*, *Buick Century*, and *Pontiac Sunfire*. Among its prominent contexts are *car*, *recalls*, and *engine* on the right, and *new* and *used* on the left. These neighbors make sense as evidence relating to automobiles. The examples also show why phrase granularity is useful. A car name can be grouped by its overall behavior, even if one of its component words is shared with expressions outside that domain.

In cluster 883, the paper shows expressions such as *secrecy agreement*, *deed of agreement*, and *memorandum of cooperation*. Forms of *sign* occur among the highest-weight contexts, along with words such as *between*. Their surroundings give the method grounds to group these expressions even when the phrase endings differ. The point is especially clear for *memorandum of cooperation*, which can fit the rest of the group through contextual evidence without containing the word *agreement*.

Cluster 286 contains personal names that the authors describe as Indian in origin, including *Pramod Kumar*, *Krishna Kumar*, and *Virendra*. Strong contexts include titles and parts of names. Several examples contain *Kumar*, and the occurrence of related names in neighboring positions contributed to the cluster. The example shows how co-occurrence with other names can support grouping as well as how contexts describing a subject, as in the vehicle cluster, can do so.

The paper also describes using the clusters to resolve conjunction scope, the question of which words a conjunction groups together. It reports better disambiguation performance with the clusters than with approaches using co-occurrence frequencies. This provides a comparison with a simpler source of corpus evidence for that application. The data split, numerical scores, and size of the improvement are absent from the account, so the result supports the reported direction of the comparison under the authors’ setup.

#### What the lexical searches establish

The paper uses instantiations of its patterns to show how grammatical restrictions can produce more focused lexical statistics. The noun-countability examples explain how a boundary condition can exclude a count that would otherwise be assigned to the wrong expression. The accounts of number, gender, and animacy explain how numerous matches can be aggregated into evidence about a phrase. An earlier study discussed in the paper found that related patterns helped unsupervised person mention detection. The paper gives that result as context for the extractor, without providing an evaluation table for it.

The VBN and VBD examples serve a similar purpose for targeted searches. The authors describe a higher count for an object-like context with *lessons* and lower counts for the comparable context with *students*. These are demonstrations of evidence available from the index. The paper supplies neither the counts for that comparison nor tagging scores on a held-out split. It also reports work on adjective ordering in generation without results for that application. Across these demonstrations, the detailed evidence concerns the construction of the queries and what their matches can tell the researcher.

### What the ablations show

The paper reports no formal ablation study, but it offers comparisons of query constraints, index designs, phrase-selection evidence, and downstream uses of corpus statistics.

#### Adding a condition changes the evidence returned

The closest example to a controlled query comparison is the Wikipedia search around *was established in*. The fixed words give both versions a common point of reference. In the broader version, both wildcard positions can take arbitrary content. The narrower version imposes entity and grammatical categories at those positions. The reported reduction in matches, together with examples of the removed types, shows that those conditions have a substantial effect on the returned set for that particular query. The conditions are introduced together, so the result does not identify which contributes more to the reduction.

The noun-boundary examples demonstrate a different control over the result set. A fixed string ending in a noun can occur at the start of a larger noun expression. Requiring a following tag that provides evidence of a boundary filters out some instances of that kind. The *river* and *water* examples show why this matters for the intended interpretation of the resulting count. They establish a concrete behavior of the pattern language. The paper leaves the overall gain from the boundary check in a countability classifier unmeasured.

Together these comparisons distinguish two reasons to constrain a wildcard or its surroundings. One is to ask for the right semantic or grammatical type in a slot. The other is to identify the extent of the expression to which the statistic will be assigned. A category condition on a slot changes what may fill it. A boundary condition changes which apparent matches plausibly end there. Both use annotation while acting on different sources of ambiguity in a query.

#### Frequency alone cannot identify a phrase unit

The paper compares a partial expression and a complete one using their corpus frequencies. It records 52,181 occurrences for *degree in computer* and 39,640 for *degree in computer science*. The more frequent sequence is the one the authors judge to be a fragment. A search for common candidates would readily admit it. The contrast makes the need for contextual evidence visible without requiring a benchmark score.

The proposed filter looks at diversity on both sides, the prevalence of stop-word contexts, and the words or punctuation in the candidate itself. The comparison explains why at least some criterion beyond frequency belongs in the procedure. It gives no separate estimate for the value of left context, right context, or the stop-word rules. In the reported pipeline, those conditions work together to determine what enters clustering. Development runs were inspected in choosing them, and the final evidence consists of the resulting clusters and the downstream comparison the authors describe.

The conjunction-scope experiment compares cluster membership with evidence based on co-occurrence frequencies. The reported advantage indicates that membership in a distributional group can be useful on that task. The experiment as described does not separate the effects of allowing multiword phrases, choosing context features in this way, weighting them, or applying K-means. Those choices all contribute to the representation whose performance is compared with the frequency-based alternatives.

#### Storage and tagging reveal different trade-offs

The Wikipedia storage comparison changes the index architecture. The authors report smaller storage with an inverted index and a small cost in speed. This establishes a practical tradeoff between the designs as implemented. The paper does not break down how much disk space each part of the newer system uses or quantify the reported speed difference. Its strongest numerical comparison for the index is the reported footprint of each design.

The tagger built over the suffix-array tool illustrates something an index optimization cannot resolve. When the source tagger repeatedly assigns a misleading label in similar contexts, aggregation preserves the error as a regularity. The *work* example shows the downstream consequence in a specific sentence. The past-tense versus past-participle investigation takes a complementary approach by seeking additional corpus evidence about the noun and verb involved. It illustrates the kind of evidence worth adding when the original tagging decision overlooks that relationship. The paper leaves open how frequently such evidence corrects errors across the corpus.

### Limitations

#### Limits the authors identify

The authors flag repeated source-tagging errors as a central problem. TnT is a tagger based on a hidden Markov approach, and the paper notes that it lacks features tied to specific pairs of words. In a construction involving a noun and a verb, the relationship between those particular words can help determine whether the verb is a past tense or a participle. If the same cues are absent from the annotator’s decisions across many occurrences, the corresponding error can recur often enough to influence the aggregate evidence. The reported Treebank accuracy leaves room for this kind of systematic error on particular constructions.

They also describe a limitation in choosing search prefixes. The fastest-looking prefix would lead to a small block of matching records. The heuristic instead uses length and the frequency of the first token to estimate how selective a prefix will be. This can be an adequate choice in their applications while remaining an indirect estimate. When the first token is common, or when it has a particularly unusual continuation, its overall frequency may give an incomplete picture of how large the particular block will be.

The authors explicitly treat their phrase criterion as an approximation. Varied surroundings are evidence that a sequence can function as a unit, and the filters are chosen to capture some of that variation. Frequent fragments explain why a frequency cutoff is insufficient. They do not imply that every useful phrase has varied neighbors. The method is tuned to produce a practical input to clustering, and the paper assesses development settings by examining clusters.

For the Wikipedia system, the authors acknowledge the search-speed cost of reducing the size of the index. They also refer readers to a separate paper for the full description of the architecture and algorithms. The account here establishes the query interface, the kind of annotation it uses, the storage comparison, and the reported response time in the stated environment. It gives only a high-level view of how the newer index and its checks produce those results.

#### Limits of the data and the evaluation

The two corpora support different inferences. The main web collection discards duplicate sentences, normalizes tokens, filters sentences, and omits rare sequences. A frequency there measures occurrences surviving those choices. A missing record can reflect the threshold or the earlier filtering steps. It therefore gives limited evidence about whether an expression ever occurs in the original source. Likewise, normalization pools occurrences with different digits. That may suit a study of grammatical patterns around numbers, while an analysis that needs to identify a specific original number requires other evidence.

The Wikipedia system retains source links and keeps low-frequency n-grams. That makes it possible to inspect individual matching occurrences. Its counts come from a different source, over a different span of sequence lengths, with additional automatic annotation. Its corpus size or match counts cannot be transferred to the web collection. An experiment that needs evidence from particular genres, years, or communities would also require information about those populations. The paper’s examples do not establish how well either collection represents them.

Local context length imposes a further limit. The extracted sequences can encode conditions within their recorded spans. A dependency that extends beyond the span may require the source sentence or some other representation. The Wikipedia interface can return sentences for inspection. The rotated web records support analyses grounded in the counted words and tags nearby. Phrase boundaries inferred from adjacent tags share that scope. The example of a following noun works because the relevant clue is close. Other distinctions can depend on structure at a greater distance.

The examples of successful retrieval demonstrate what the query language can express. They do not constitute a validation of every tag or a test of retrieval quality across many queries. The Wikipedia comparison reports that fewer n-grams match after conditions are added. It gives no annotated set of intended matches against which to measure false positives and missed occurrences. A frequent repeated error in the source labels could affect both the volume and the apparent quality of the output.

The cluster examples present phrases closest to selected centroids and features with large weights. They show the central members of some interpretable groups. Judging how consistently the resource groups phrases throughout would require evidence about other clusters, their less central members, or some broader reference standard. The account also gives no comparison across random initializations. The examples establish the kinds of groups the method produced and the local evidence that characterized them.

Finally, the paper’s descriptions of performance are strongest where it provides a concrete count, size, or setup. The index footprints, corpus sizes, and clustering configuration can be stated precisely. The conjunction-scope claim gives a direction of improvement without the underlying benchmark scores. The efficiency claims for exact search, ranked search, and batch processing come from the tools’ designs and uses, with no common timing benchmark. A reader can understand which workload motivated each tool and what the reported demonstrations establish while leaving general performance comparisons open.

### What came after

The later citing papers take up problems in which language outside an annotated example can provide evidence about the example itself. Their titles establish the tasks they address, and one explicitly identifies web-scale n-grams as the resource under study. The citations establish a connection to “New Tools for Web-Scale N-grams.” They do not, by themselves, identify the index, annotation, or released clusters used in each case.

The link is most direct in *Using Web-scale N-grams to Improve Base NP Parsing Performance*. Its task is base noun-phrase [parsing](https://md.research.elamur.ai/free/en/concepts/parsing/), the analysis of local noun groups. The work puts web-scale n-grams in the role of evidence for a parsing decision. This is closely related to the distinction illustrated by *water* in the tools paper. That demonstration uses grammatical boundary evidence to decide which counts to gather. The parsing title poses the complementary question of whether evidence in large sequence counts can help a system decide how to analyze a noun group. [Using Web-scale N-grams to Improve Base NP Parsing Performance](https://md.research.elamur.ai/free/en/papers/pitler-2010-web-scale-n-grams-improve/)

*Coreference Semantics from Web Features* addresses [coreference resolution](https://md.research.elamur.ai/free/en/concepts/coreference-resolution/), the task of determining which mentions refer to the same entity. Its title identifies web features as a source of semantic evidence. The tools paper illustrates the relevant general move by collecting evidence about animacy, gender, and number from contexts in which phrases are used. Such properties concern the referents of expressions and can matter when comparing mentions. The citation and title establish the connection through web-derived features, with the specific feature inventory and retrieval procedure left unspecified here. [Coreference Semantics from Web Features](https://md.research.elamur.ai/free/en/papers/bansal-2012-coreference-semantics-web-features/)

*PPDB: The Paraphrase Database* represents a connection through lexical resources. A paraphrase database gathers alternative expressions with corresponding meanings. The n-gram paper also makes relationships among expressions available outside the original search process, through a resource of phrases grouped by similar contexts. The relationship of interest differs in each case. Distributional clusters can bring together members of a category, such as different car names, while a paraphrase resource concerns alternative formulations. The later work’s title identifies the resource it contributes, and its citation places it in contact with the earlier effort to build reusable phrase-level evidence. [PPDB: The Paraphrase Database](https://md.research.elamur.ai/free/en/papers/ganitkevitch-2013-ppdb-paraphrase-database/)

*What Makes Writing Great?* takes on article quality prediction in science journalism. Its unit of prediction is an article. This is a different scale of analysis from deciding which tag a word should receive or whether two phrases have similar distributions. The tools paper makes local usage statistics available as evidence that other tasks can consume. The citation connects that work with an investigation of writing quality, though its title leaves open which statistics were used and how they contributed to the predictions. [What Makes Writing Great?](https://md.research.elamur.ai/free/en/papers/louis-2013-what-makes-writing-great-first/)

## Cite

Cite as Dekang Lin, Kenneth Church, Heng Ji, Satoshi Sekine, David Yarowsky, Shane Bergsma, Kailash Patil, Emily Pitler, Rachel Lathbury, Vikram Rao, Kapil Dalwani and Sushant Narsale. 2010. New Tools for Web-Scale N-grams. Proceedings of the Seventh International Conference on Language Resources and Evaluation (LREC'10).

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@inproceedings{lin2010new,
  title = {{New Tools for Web-Scale N-grams}},
  author = {Dekang Lin, Kenneth Church, Heng Ji, Satoshi Sekine, David Yarowsky, Shane Bergsma, Kailash Patil, Emily Pitler, Rachel Lathbury, Vikram Rao, Kapil Dalwani and Sushant Narsale},
  booktitle = {Proceedings of the Seventh International Conference on Language Resources and Evaluation (LREC'10)},
  year = {2010},
  doi = {10.63317/44fpr4ygd2xg},
  url = {https://doi.org/10.63317/44fpr4ygd2xg}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
