N-gram
定义 Definition
n-gram(N 元语法/ N 元组)指在一段文本或符号序列中,连续出现的 n 个单位(通常是词、字母或字符)组成的片段,用于统计与建模语言模式。常见的有 unigram(1-gram)、bigram(2-gram)、trigram(3-gram) 等。(在自然语言处理与信息检索中最常见。)
发音 Pronunciation (IPA)
/ˈɛn ɡræm/
例句 Examples
We trained a bigram n-gram model on news text.
我们在新闻文本上训练了一个二元(bigram)的 n-gram 模型。
In a language model, n-grams approximate word sequences by assuming each word depends mainly on the previous n−1 words.
在语言模型中,n-gram 通过假设每个词主要依赖于前面 n−1 个词来近似建模词序列。
词源 Etymology
n-gram由 n(表示“任意长度 n”这一变量)+ gram(来自希腊语 gramma,意为“字母、书写的东西”)构成,字面意思可理解为“由 n 个书写单位组成的片段”。该术语在统计语言模型、信息论与计算语言学的发展中被广泛使用。
相关词 Related Words
文学与著作中的用例 Literary Works
- Daniel Jurafsky & James H. Martin,《Speech and Language Processing》:在语言模型章节系统介绍 n-gram 模型及其应用。
- Christopher D. Manning & Hinrich Schütze,《Foundations of Statistical Natural Language Processing》:以 n-gram 作为统计 NLP 的基础方法之一进行讨论。
- Claude E. Shannon,“A Mathematical Theory of Communication”(1948):以字符序列的统计近似思想奠定相关背景,常被用于解释 n-gram 语言模型的直观来源。
- Manning, Raghavan & Schütze,《Introduction to Information Retrieval》:在检索与文本表示相关内容中涉及基于 n-gram 的方法与特征表示。