中文分词工具包 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

A Guide to Monte Carlo Simulations in Statistical Physics

A Guide to Monte Carlo Simulations in Statistical Physics

Landau, David P./ Binder, Kurt / Cambridge Univ Pr / 2005-9 / 786.00元

This new and updated edition deals with all aspects of Monte Carlo simulation of complex physical systems encountered in condensed-matter physics, statistical mechanics, and related fields. After brie......一起来看看 《A Guide to Monte Carlo Simulations in Statistical Physics》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

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

Base64 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具