GithubHelp home page GithubHelp logo

foolnltk's Introduction

FoolNLTK

中文处理工具包

特点

  • 可能不是最快的开源中文分词,但很可能是最准的开源中文分词
  • 基于BiLSTM模型训练而成
  • 包含分词,词性标注,实体识别, 都有比较高的准确率
  • 用户自定义词典

Install

pip install foolnltk

使用说明

分词
import fool

text = "一个傻子在北京"
print(fool.cut(text))
# ['一个', '傻子', '在', '北京']

命令行分词

python -m fool [filename]
用户自定义词典

词典格式格式如下,词的权重越高,词的长度越长就越越可能出现, 权重值请大于1

难受香菇 10
什么鬼 10
分词工具 10
北京 10
北京*** 10

加载词典

import fool
fool.load_userdict(path)
text = "我在北京***看你难受香菇"
print(fool.cut(text))
# ['我', '在', '北京***', '看', '你', '难受香菇']

删除词典

fool.delete_userdict();
词性标注
import fool

text = "一个傻子在北京"
print(fool.pos_cut(text))
#[('一个', 'm'), ('傻子', 'n'), ('在', 'p'), ('北京', 'ns')]
实体识别
import fool 

text = "一个傻子在北京"
words, ners = fool.analysis(text)
print(ners)
#[(5, 8, 'location', '北京')]

注意

  • 暂时只在Python3 Linux 平台测试通过

foolnltk's People

Watchers

James Cloos avatar shuai.nie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.