Chinese_segment_augment icon indicating copy to clipboard operation
Chinese_segment_augment copied to clipboard

python3实现互信息和左右熵的新词发现

Results 9 Chinese_segment_augment issues
Sort by recently updated
recently updated
newest added

主要修改了model.py文件,把原来child的list改成dict结构,提高计算效率。

您好,请问为什么运行出来发现左右熵基本都为零呢?

![image](https://user-images.githubusercontent.com/4702353/88126030-3be43080-cc03-11ea-9cdc-dad192a127e8.png) @zhanzecheng 谢谢!!

PMI = math.log(max(ch.count, 1), 2) - math.log(total, 2) - math.log(one_dict[child.char], 2) - math.log(one_dict[ch.char], 2) 为什么和log2( P(X,Y) / (P(X) * P(Y))感觉不一样?

==>result[key] = (values[0] + min(left[d], right[d])) * values[1] 这一步理解不了是在干什么,我的理解是只要取 左右熵中的最小值作为 这一步需要赋值的值就可以了 def find_word(self, N): # 通过搜索得到互信息 # 例如: dict{ "a_b": (PMI, 出现概率), .. } bi = self.search_bi() # 通过搜索得到左右熵 left...

互信息和左右熵通过语料不是就可以计算了吗?为什么需要一个外部词表呢?

假设有两个词串分别是[a,b,c]和[b,c,a],[a,b,c]在计算左熵的时候会转换成b->c->a存储到树中,[b,c,a]在顺序存储的时候也会转换成b->c->a存储到树中,那么这个时候计算bc的左熵的时候会有问题把,额外把a的次数多加了一。

请您看一下这里应该是这样的吗?