中文分词工具包 smallseg

码农软件 · 软件分类 · 中文分词库 · 2019-08-29 12:43:32

软件介绍

smallseg -- 开源的,基于DFA的轻量级的中文分词工具包

特点:可自定义词典、切割后返回登录词列表和未登录词列表、有一定的新词识别能力。

Python 示例代码:

s3 = file("text.txt").read()
words = [x.rstrip() for x in file("main.dic") ]

from smallseg import SEG
seg = SEG()
print 'Load dict...'
seg.set(words)
print "Dict is OK."

A,B = seg.cut(s3) #A是识别出的登录词列表,B是未登录词列表
for t in A:
    try:
        print t.decode('utf-8')
    except:
        pass
print "============================"
for t in B:
    try:
        print t.decode('utf-8')
    except:
        pass

Java 示例代码: 

Seg seg = new Seg();
seg.useDefaultDict();
System.out.println(seg.cut("至于在这个程序中没有太大的意义, 这是Java提供的强制转化机制。草泥马"));

stdout>>
r:[至于, 在这, 程序, 没有, 太大, 意义, 这是, 提供, 强制, 转化, 机制]
u:[Java, 草泥马, 泥马]
(因为“草泥马”并没有在词库中)

本文地址:https://codercto.com/soft/d/13423.html

具体数学(英文版第2版)

具体数学(英文版第2版)

[美] Ronald L. Graham、Donald E. Knuth、Oren Patashnik / 机械工业出版社 / 2002-8 / 49.00元

This book introduces the mathematics that supports advanced computer Programming and the analysis of algorithms. The primary aim of its well-known authors is to provide a solid and relevant base of ma......一起来看看 《具体数学(英文版第2版)》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具