这次的试验参考了网上的资源:
GitHub - Forec/Markov-Speaking: 一个使用马尔科夫链算法构建中/英文语句的类,提供了解析文本和生成语言的接口
使用方法:
>>> import markov_speaking
>>> p = markov_speaking.Markov('swords.txt', 1)
Building prefix dict from the default dictionary ...
Loading model from cache /home/forec/cache
Dumping model to file cache /home/forec/cache
Loading model cost 1.578 seconds.
Prefix dict has been built succesfully.
>>> p.say(5)
忽然想到一计说道师伯令狐师兄行侠仗义。