Share to: share facebook share twitter share wa share telegram print page

語言模型

語言模型是一個自然語言中的詞語機率分佈模型[1][2],例如提供一个长度为 的字詞序列 ,計算這些字詞的概率:。通過语言模型,可以确定哪个词语出现的可能性更大,或者通過若干上文语境词来预测下一个最可能出现的词语。[3]

語言模型經常使用在許多自然語言處理方面的應用,如語音識別[4]機器翻譯[5],詞性標註,句法分析[6],手写体识别[7]資訊檢索。由於字詞與句子都是任意組合的長度,因此在訓練過的語言模型中會出現未曾出現的字串(資料稀疏的問題),也使得在語料庫中估算字串的機率變得很困難,這也是要使用近似的平滑n-元語法(N-gram)模型之原因。

語音辨識和在資料壓縮的領域中,這種模式試圖捕捉語言的特性,並預測在語音串列中的下一個字。

在语音识别中,声音与单词序列相匹配。当来自语言模型的证据与发音模型和声学模型相结合时,歧义更容易解决。

當用於資訊檢索,語言模型是與文件有關的集合。以查詢字「Q」作為輸入,依據機率將文件作排序,而該機率代表該文件的語言模型所產生的語句之機率。

模型类型

单元语法(unigram)

一个单元模型可以看作是几个单状态有限自动机的组合[8]。 它会分开上下文中不同术语的概率, 比如将 拆分为.

在这个模型中,每个单词的概率只取决于该单词在文档中的概率,所以我们只有一个状态有限自动机作为单位。自动机本身在模型的整个词汇表中有一个概率分布,总和为1。下面是一个文档的单元模型。

单词 term 在文档 doc 中的概率
a 0.1
world 0.2
likes 0.05
we 0.05
share 0.3
... ...

为特定查询(query)生成的概率计算如下

不同的文档有不同的语法模型,其中单词的命中率也不同。不同文档的概率分布用于为每个查询生成命中概率。可以根据概率对查询的文档进行排序。两个文档的单元模型示例:

单词 在Doc1的概率 在Doc2中的概率
a 0.1 0.3
world 0.2 0.1
likes 0.05 0.03
we 0.05 0.02
share 0.3 0.2
... ... ...

在信息检索环境中,通常会对单语法语言模型进行平滑处理,以避免出现P(term)= 0的情况。一种常见的方法是为整个集合生成最大似然模型,并用每个文档的最大似然模型对集合模型进行线性插值来平滑化模型。[9]

n-元语法

在一个 n-元语法模型中,观测到序列 的概率 可以被近似为

此处我们引入马尔科夫假设,一个词的出现并不与这个句子前面的所有词关联,只与这个词前的 n 个词关联(n阶马尔科夫性质)。在已观测到 i-1 个词的情况中,观测到第i个词 wi 的概率,可以被近似为,观测到第i个词前面n个词(第 i-(n-1) 个词到第 i-1 个词)的情况下,观测到第i个词的概率。第 i 个词前 n 个词可以被称为 n-元。

条件概率可以从n-元语法模型频率计数中计算:

术语 二元语法(bigram) 和三元语法(trigram) 语言模型表示 n = 2 和 n = 3 的 n-元 [10]

典型地,n-元语法模型概率不是直接从频率计数中导出的,因为以这种方式导出的模型在面对任何之前没有明确看到的n-元时会有严重的问题。相反,某种形式的平滑是必要的,将一些总概率质量分配给看不见的单词或n-元。使用了各种方法,从简单的“加一”平滑(将计数1分配给看不见的n-元,作为一个无信息的先验)到更复杂的模型,例如Good-Turing discounting英语Good-Turing discountingback-off 模型英语back-off model

例子

在二元语法模型中 (n = 2) , I saw the red house 这个句子的概率可以被估计为

而在三元语法模型中,这个句子的概率估计为

注意前 n-1 个词的 n-元会用句首符号 <s> 填充。

指数型

最大熵英语Principle of maximum entropy语言模型用特征函数编码了词和n-元的关系。

其中 分区函数英语partition function, 是参数向量, 是特征函数。

在最简单的情况下,特征函数只是某个n-gram存在的指示器。使用先验的 a 或者使用一些正则化的手段是很有用的。

对数双线性模型是指数型语言模型的另一个例子。

参见

参考资料

  1. ^ Jurafsky, Dan; Martin, James H. N-gram Language Models. Speech and Language Processing 3rd. 2021 [24 May 2022]. (原始内容存档于22 May 2022). 
  2. ^ Rosenfeld, Ronald. Two decades of statistical language modeling: Where do we go from here?. Proceedings of the IEEE. 2000, 88 (8). 
  3. ^ 王亚珅,黄河燕著,短文本表示建模及应用,北京理工大学出版社,2021.05,第24頁
  4. ^ Kuhn, Roland, and Renato De Mori. "A cache-based natural language model for speech recognition." IEEE transactions on pattern analysis and machine intelligence 12.6 (1990): 570-583.
  5. ^ Andreas, Jacob, Andreas Vlachos, and Stephen Clark. "Semantic parsing as machine translation页面存档备份,存于互联网档案馆)." Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers). 2013.
  6. ^ Andreas, Jacob, Andreas Vlachos, and Stephen Clark. "Semantic parsing as machine translation页面存档备份,存于互联网档案馆)." Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers). 2013.
  7. ^ Pham, Vu, et al. "Dropout improves recurrent neural networks for handwriting recognition." 2014 14th International Conference on Frontiers in Handwriting Recognition. IEEE, 2014.
  8. ^ Christopher D. Manning, Prabhakar Raghavan, Hinrich Schütze: An Introduction to Information Retrieval, pages 237–240. Cambridge University Press, 2009
  9. ^ Buttcher, Clarke, and Cormack. Information Retrieval: Implementing and Evaluating Search Engines. pg. 289–291. MIT Press.
  10. ^ Craig Trim, What is Language Modeling?页面存档备份,存于互联网档案馆), April 26th, 2013.

外部链接


Read other articles:

Ferenc Pavlics in 2010 The native form of this personal name is Pavlics Ferenc. This article uses Western name order when mentioning individuals. Ferenc Pavlics (born 3 February 1928) is a Hungarian-born American mechanical engineer who developed the Apollo Lunar rover. Early life Ferenc Pavlics was born in Balozsameggyes (Vas county, Hungary) on February 3, 1928. His father Károly Pavlics and mother Rosina Perusich were both teachers teaching in the elementary school of Balozsameggyes. At …

Військово-історичний комплекс «Михайлівська батарея» 44°37′40″ пн. ш. 33°31′33″ сх. д. / 44.62778° пн. ш. 33.52583° сх. д. / 44.62778; 33.52583Тип фортецяКраїна  УкраїнаРозташування місто Севастополь, Північна сторонаЗасновано 4 липня 2010 рокуДиректор Роман Б

Місто Ріенціангл. Rienzi Координати 34°45′52″ пн. ш. 88°31′45″ зх. д. / 34.76470000002777283° пн. ш. 88.52920000002778522° зх. д. / 34.76470000002777283; -88.52920000002778522Координати: 34°45′52″ пн. ш. 88°31′45″ зх. д. / 34.76470000002777283° пн. ш. 88.52920000002778522° зх. д. / 34.764…

Elm cultivar Ulmus 'Cathedral''Cathedral' in Jean Desmetstraat, AmsterdamGenusUlmusHybrid parentageU. davidiana var. japonica × U. pumilaCultivar'Cathedral'OriginWARF, Wisconsin, US Ulmus 'Cathedral' is a hybrid cultivar raised at University of Wisconsin–Madison (no. W44-25) patented in 1994. Arising from a chance crossing of the Japanese elm (female parent) and Siberian elm, seed was sent in 1958 by Prof. Nobuku Takahashi and his colleagues at the Sapporo Botanical Garden of Hokkaido Univers…

Johan Gabriel Anrep (um 1900) Johan Gabriel Anrep (* 4. Dezember 1821 in Lekeberg; † 12. März 1907 in Stockholm) war ein schwedischer Genealoge und Begründer der modernen Adelsforschung in Schweden. Inhaltsverzeichnis 1 Leben 2 Werke 3 Literatur 4 Weblinks Leben Gabriel Anrep entstammte dem deutsch-baltischen Adelsgeschlecht der Herren von Anrep. Seine Eltern waren Johan Wilhelm Anrep († 1848) und Maria Margareta Palin. Er wuchs auf dem väterlichen Gut in Lekeberg auf. Nach dem Verkauf vo…

Southeast Alaska has an unusual climate that allows a large number of edible plant and edible mushroom species to grow. The area consists primarily of the Tongass National Forest, which is a temperate rainforest. This rainforest has plenty of precipitation and the temperature remains relatively constant, therefore many plant and fungi species flourish there. On a geological time scale, fairly recently during the Little Ice Age, glaciers were abundant in Southeast Alaska. The ice age's last maxim…

Tassili n'AjjerSitus Warisan Dunia UNESCOLokasiAljazairMemuatTaman Nasional Tassili, La Vallée d'Iherir Ramsar WetlandKriteriaKebudayaan dan Alam: (i), (iii), (vii), (viii)Nomor identifikasi179Pengukuhan1982 (Sesi ke-6)Luas[convert: nomor tidak sah]Koordinat25°30′N 9°0′E / 25.500°N 9.000°E / 25.500; 9.000Koordinat: 25°30′N 9°0′E / 25.500°N 9.000°E / 25.500; 9.000IUCN Kategori II (Taman Nasional)LetakProvinsi Tamanghas…

جمعية الصدر البريطانية الاختصار BTS البلد المملكة المتحدة  المقر الرئيسي لندن  تاريخ التأسيس 1982 الاهتمامات طب الصدر في المملكة المتحدة منطقة الخدمة المملكة المتحدة الرئيس التنفيذي شيلا إدواردز الجهاز الرئيسي المجلس التنفيذي لجمعية الصدر البريطانية (الرئيس - الأستاذ م

Town in Louisiana, United StatesSt. FrancisvilleTownTown of St. FrancisvilleOne of several former plantation houses near St. FrancisvilleLocation of St. Francisville in West Feliciana Parish, Louisiana.Location of Louisiana in the United StatesCoordinates: 30°47′05″N 91°22′50″W / 30.78472°N 91.38056°W / 30.78472; -91.38056CountryUnited StatesStateLouisianaParishWest FelicianaEstablished1807Government • MayorBobbee LeakeArea[1] • …

Jérôme Boateng Boateng, 2019Informasi pribadiNama lengkap Jérôme Agyenim Boateng[1]Tanggal lahir 3 September 1988 (umur 35)[2]Tempat lahir Berlin, Jerman BaratTinggi 1,90 m (6 ft 3 in)[3]Posisi bermain Bek[4]Karier junior1994–2002 Tennis Borussia Berlin2002–2006 Hertha BSCKarier senior*Tahun Tim Tampil (Gol)2006–2007 Hertha BSC II 24 (1)2007 Hertha BSC 10 (0)2007–2010 Hamburger SV 75 (0)2010–2011 Manchester City 16 (0)2011–2021 …

International sporting eventWomen's quadruple sculls at the 2023 Pan American GamesVenueLaguna GrandeDatesOctober 23Competitors24 from 6 nationsWinning time6:26.04Medalists Grace JoyceVeronica NicacioMadeleine FochtKatherine Horvat  United States Christina HostetterVictoria HostetterMelita AbrahamAntonia Abraham  Chile Kendra HartleyParker IllingworthAlizée BrienShaye de Paiva  Canada«2019 Rowing at the2023 Pan American GamesQualifica…

Historical small mosque in Tarsus, Mersin Province, Turkey For the mosque in Palestine, see Bilal ibn Rabah mosque. Bilal-i Habeşi MosqueReligionAffiliationSunni IslamLocationLocationTarsus, Mersin, TurkeyGeographic coordinates36°54′55″N 34°53′49″E / 36.91528°N 34.89694°E / 36.91528; 34.89694ArchitectureDate established16th century Sarcophagus inside the Bilal-i Habeşi Masjid Bilal-i Habeşi Masjid is a historical small mosque in Tarsus, Mersin Province, Tur…

NXT Women's ChampionshipSabuk NXT Women's Championship saat ini.InformasiJuara saat iniAsukaTanggal dimenangkan1 April 2016Tanggal dibentuk5 April 2013PromotorWWEMerekNXTStatistikPemegang pertamaPaige[1]Pemegang terbanyakSemua (1 kali)Pemegang terlamaPaige (308 hari)Pemegang tersingkatSasha Banks (192 hari)Pemegang tertuaAsuka (34 tahun, 188 hari)Pemegang termudaPaige (20 tahun, 308 hari)Pemegang terberatAsuka 137 lbs (62 kg)Pemegang paling ringanSasha Banks 114 lbs (…

Banda Bakali pada 2017 Banda Bakali atau Bandakali adalah istilah dalam bahasa Minang untuk menyebut sungai buatan atau kanal yang terdapat di Kota Padang, Sumatera Barat, Indonesia. Kanal banjir ini membagi aliran Batang Arau di Lubuk Begalung ke arah utara sepanjang 6,8 km dan lebar 20 m dengan muara di dekat Pantai Purus. Banda Bakali dibangun untuk mengatasi banjir di Kota Padang sekaligus menopang sistem drainase tata ruang kota (muara sungai-sungai kecil, pengeringan rawa-rawa, salura…

Montlake PlayfieldPart of Montlake Playfield and Montlake Community Center.TypePlayfieldLocationSeattle, Washington, United States Montlake Playfield is a 27-acre (100,000 m²) park and playfield on Portage Bay in the Montlake neighborhood of Seattle, Washington, USA. Originally a 20-foot-deep peat bog, the playfield site was first developed as part of a dahlia farm. The farm extended considerably further south than the present playfield: its southernmost part was south of Lynn Street, the land …

2013 studio album by Jenny HvalInnocence Is KinkyStudio album by Jenny HvalReleased19 April 2013 (2013-04-19)GenreArt pop, experimental rockLength41:52LabelRune GrammofonProducerJohn ParishJenny Hval chronology Viscera(2011) Innocence Is Kinky(2013) Apocalypse, girl(2015) Professional ratingsAggregate scoresSourceRatingAnyDecentMusic?8.4/10[1]Metacritic87/100[2]Review scoresSourceRatingAllMusic[3]Beats Per Minute85%[4]Drowned in Sound8/10 …

Village in Rhode Island, U.S. North Kingstown Food Pantry Davisville is a village in the town of North Kingstown in the U.S. state of Rhode Island that was formerly the home of the Davisville Naval Construction Battalion Center, which housed the United States Navy's SeaBees. Village description Both Amtrak and MBTA's Providence/Stoughton Line pass through Davisville, though there is no railroad station here. A proposed MBTA station is currently being considered. Davisville NCBC It was located at…

Collection of letters by Seneca Epistulae Morales ad Lucilium 15th-century illuminated manuscript, Laurentian LibraryAuthorSenecaCountryAncient RomeLanguageLatinSubjectEthicsGenrePhilosophyPublication datec. 65 ADTextEpistulae Morales ad Lucilium at Wikisource The Epistulae Morales ad Lucilium (Latin for Moral Letters to Lucilius), also known as the Moral Epistles and Letters from a Stoic, is a collection of 124 letters that Seneca the Younger wrote at the end of his life, during his retir…

Academic journalAsian Theatre JournalDisciplineperforming artsLanguageEnglishEdited bySiyuan LiuPublication detailsHistory1984–presentPublisherUniversity of Hawaii Press (United States)FrequencyBiannualStandard abbreviationsISO 4 (alt) · Bluebook (alt1 · alt2)NLM (alt) · MathSciNet (alt )ISO 4Asian Theatre J.IndexingCODEN (alt · alt2) · JSTOR (alt) · LCCN (alt)MIAR · NLM (alt) ·…

Spanish cybersecurity software company This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article contains content that is written like an advertisement. Please help improve it by removing promotional content and inappropriate external links, and by adding encyclopedic content written from a neutral point of view. (April 2016) (Learn how and when to remove this template message) This artic…

Kembali kehalaman sebelumnya