mmseg算法中的问题
mmseg中复杂最大匹配算法没看明白,有人能用一个例子给我解释下吗?
回复内容:
mmseg中复杂最大匹配算法没看明白,有人能用一个例子给我解释下吗?
首先先定義 MMSEG 一個重要概念是 Chunk ,他是一個包含3個詞的詞塊。
MMSEG 算法是基於統計模型的,所以算法的規則也是來自於對語料庫的分析和歸納。
他有四大規則分別為:
規則 1 : 最大匹配 Maximum matching (取詞包含字數最多的chunk)
規則 2 : 最大平均詞彙長度 Largest average word length (取詞的平均字數最多的chunk)
規則 3 : 最小詞方差 Smallest variance of word lengths (取詞的方差最小的chunk)
規則 4 : 最大單字自由度 Largest sum of degree of morphemic freedom of one-character words
<code> (取詞頻自由度最大的chunk, 也就是chunk中的詞的詞頻取對數後的和,) </code>
舉的例子比較快了解:
我們用 MMSEG 上的例子 "研究生命起源",但首先先釐清一點,切 Chunk 通常跟你自己的語料庫(詞典)有很大關係,不一定會切出跟下面一樣的 Chunk。
研 |究 |生 (length = 3)
研 |究 |生命 (length = 4)
研究 |生 |命 (length = 4)
研究 |生命|起 (length = 5)
研究 |生命|起源 (length = 6)
研究生|命 |起 (length = 5)
研究生|命 |起源 (length = 6)
之後依次使用上述四種規則匹配之-
依據規則 1,取length最大的 Chunk
研究 |生命|起源 (length = 6, average length = 2)
研究生|命 |起源 (length = 6, average length = 2)
依據規則 2,取average length最大的 Chunk
研究 |生命|起源 (length = 6, average length = 2, variance = 0 )
研究生|命 |起源 (length = 6, average length = 2, variance = 4/9)
依據規則 3,取variance最小的 Chunk
研究 |生命|起源 (length = 6, average length = 2, variance = 0 )
因為剩下一個 Chunk 所以規則 4 就不用再匹配了。
最終結果就是 "研究 | 生命 | 起源"
若需要用到規則 4 ,當中所謂的詞頻,是要你自己在你的辭典先定義辭典裡的每一個詞的在你的資料及的某個時間點知當時的詞頻。
例如 第5號 Chunk : "研究" 詞頻=3 , "生命" 詞頻=5 , "起源" 詞頻=7
取對數的和 = ln3+ln5+ln7
其他 Chunk 也用同樣的算法算出其對數和,
最後所以剩下的 Chunk 比對誰最大就取誰即可。
但是如果最後的匹配四個規則的結果得到不只一個 Chunk ,那麼 MMSEG 就失效了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

Golang is better than Python in terms of performance and scalability. 1) Golang's compilation-type characteristics and efficient concurrency model make it perform well in high concurrency scenarios. 2) Python, as an interpreted language, executes slowly, but can optimize performance through tools such as Cython.

Python is easier to learn and use, while C is more powerful but complex. 1. Python syntax is concise and suitable for beginners. Dynamic typing and automatic memory management make it easy to use, but may cause runtime errors. 2.C provides low-level control and advanced features, suitable for high-performance applications, but has a high learning threshold and requires manual memory and type safety management.
