0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[個人メモ]n-gramの計算方法

Last updated at Posted at 2022-03-28

n-gram

辞書

私は社会人です。
あの本は私のものです。
彼は学生です。
学生の生活は楽しいです。
私は先生です。

↑によって、私は学生ですという言葉の確率を計算するなら↓:

P(s) = P(私 | BOS) x P(は | 私) x P(学生 | は) x P(です | 学生) x P(EOS | です)
= (2 / 5) x (2 / 5) x (1 / 5) x (1 / 5) x (1 / 5) x (5 / 5)

備考

  • P(M | N): Nが確定事件という前提として、Mの確率
  • BOS: 文言の開始のマーク
  • EOS: 文言の終わりのマーク

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?