NLP自然语言处理—N-gramlanguagemodel课件分解

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

百度文库n 1 C ( w n 1 n N 1wn ) P(wn | wn ) N 1 n 1 C (wn N 1 )
• To have a consistent probabilistic model, append a unique start (<s>) and end (</s>) symbol to every sentence and treat these as additional words.
– Unigram: P(phone) – Bigram: P(phone | cell) – Trigram: P(phone | your cell)
• The Markov assumption is the presumption that the future behavior of a dynamical system only depends on its recent history. In particular, in a kth-order Markov model, the next state only depends on the k most recent states, therefore an N-gram model is a (N1)-order Markov model.
Generative Model & MLE
• Predictive text input systems can guess what you are typing and give choices on how to complete it.
N-Gram Models
• Estimate probability of each word given prior context.
Uses of Language Models
• Speech recognition
– “I ate a cherry” is a more likely sentence than “Eye eight uh Jerry”
• OCR & Handwriting recognition
– More probable sentences are more likely correct readings.
n
• Bigram approximation n n P( w1 ) P( wk | wk 1 ) k 1 • N-gram approximation
k 1 P( w ) P( wk | wk N 1 ) n 1 k 1 n
k 1
Estimating Probabilities
• Machine translation
– More likely sentences are probably better translations.
• Generation
– More likely sentences are probably better NL generations.
• Context sensitive spelling correction
– P(phone | Please turn off your cell)
• Number of parameters required grows exponentially with the number of words of prior context. • An N-gram model uses only N1 words of prior context.
N-Gram Model Formulas
• Word sequences
w1n w1...wn
• Chain rule of probability
n 1 2 1 n 1 1
P( w ) P( w1 ) P( w2 | w1 ) P(w3 | w )...P( wn | w ) P( wk | w1k 1 )
• N-gram conditional probabilities can be estimated from raw text based on the relative frequency of word sequences.
Bigram: N-gram:
P( wn | wn 1 ) C ( wn 1wn ) C ( wn 1 )
– “Their are problems wit this sentence.”
Completion Prediction
• A language model also supports predicting the completion of a sentence.
– Please turn off your cell _____ – Your program does not ______
CS 388: Natural Language Processing:
N-Gram Language Models
Raymond J. Mooney
University of Texas at Austin
1
Language Models
• Formal grammars (e.g. regular, context free) give a hard “binary” model of the legal sentences in a language. • For NLP, a probabilistic model of a language that gives a probability that a string is a member of a language is more useful. • To specify a correct probability distribution, the probability of all sentences in a language must sum to 1.
相关文档
最新文档