要求: 1 采用基于语言模型的最大概率法进行汉语切分。 2 切分算法中的语言模型可以采用n-gram语言模型,要求n >1,并至少采用一种平滑方法; 代码: 废话不说,代码是最好的语言 import re import math MAX_SPLITLEN = 4#最大切分长度 corpus_lib = ''#corpus:语料 def init_corpus_lib(path): # 初始化语料库 global corpus_lib with open(path, 'r', encoding='utf-8', errors='ignore') as file: corpus_lib
2022-06-22 09:27:05 73KB python 方法 概率计算
1
并行计算三种方式计算π:概率法,积分法,级数法,代码中包括计算量和线程个数设置。 使用时进行编译后输入相应提示的数值即可,例如N=100000 t=8
2020-05-16 15:40:26 2KB 并行计算 概率法 积分法 级数法
1