GithubHelp home page GithubHelp logo

ckiptagger_interface's Introduction

interface for CkipTagger

CkipTagger,中研院中文斷詞系統

讓你更方便的使用CkipTagger

這只是一個讓你方便使用CkipTagger的接口,所有斷詞功能與成果均與本人無關,任何接口以外的問題請至CkipTagger尋找答案與幫助

Installation

請確保已經安裝tensorflow

  • 安裝ckip-tagger
pip install -U ckiptagger
  • 安裝 interface for CkipTagger
pip install git+https://github.com/p208p2002/ckiptagger_interface.git
  • 下載data(約2G)
pip install gdown
python download_data.py

Manual download model files

The model files are available on several mirror sites.

Usage

Init

def __init__(self,ckip_data_path, custom_dict_path, disable_cuda, cuda_memory_limi):
  • ckip_data_path: 對應ckip data 資料夾。
    • default : "./data"
  • custom_dict_path: 所有資料夾底下的檔案會被載入作為recommend_dictionary
    • default: "./dict"
  • disable_cuda: 禁用cuda device
    • default: True
  • cuda_memory_limi: cuda device 顯存限制(MB)
    • default: 2048

Parse

from ckiptagger_interface import ckiptagger
ckip = ckiptagger()
sentence = [
    '國民黨總統參選人韓國瑜8日大造勢","主辦單位稱現場湧入35萬人',
    '**進步黨,簡稱民進黨,是中華民國主要政黨之一,也是現時中華民國的執政黨及立法院最大黨']
print(ckip.parse(sentence))

# [[('國民黨', 'Nb', 'ORG'), ('總統', 'Na', 'NONE'), ('參選人', 'Na', 'NONE'), ('韓國瑜', 'Nb', 'PERSON'), ('8日', 'Nd', 'DATE'), ('大', 'VH', 'NONE'), ('造勢', 'VB', 'NONE'), ('"', 'FW', 'NONE'), (',', 'COMMACATEGORY', 'NONE'), ('"', 'FW', 'NONE'), ('主辦', 'VC', 'NONE'), ('單位', 'Na', 'NONE'), ('稱', 'VG', 'NONE'), ('現場', 'Nc', 'NONE'), ('湧入', 'VCL', 'NONE'), ('35萬', 'Neu', 'CARDINAL'), ('人', 'Na', 'NONE')], [('**進步黨', 'Nb', 'ORG'), (',', 'COMMACATEGORY', 'NONE'), ('簡稱', 'VG', 'NONE'), ('民進黨', 'Nb', 'ORG'), (',', 'COMMACATEGORY', 'NONE'), ('是', 'SHI', 'NONE'), ('中華民國', 'Nc', 'GPE'), ('主要', 'A', 'NONE'), ('政黨', 'Na', 'NONE'), ('之', 'DE', 'NONE'), ('一', 'Neu', 'NONE'), (',', 'COMMACATEGORY', 'NONE'), ('也', 'D', 'NONE'), ('是', 'SHI', 'NONE'), ('現時', 'Nd', 'NONE'), ('中華民國', 'Nc', 'GPE'), ('的', 'DE', 'NONE'), ('執政黨', 'Na', 'NONE'), ('及', 'Caa', 'NONE'), ('立法院', 'Nc', 'ORG'), ('最', 'Dfa', 'NONE'), ('大', 'VH', 'NONE'), ('黨', 'Na', 'NONE')]]

ckiptagger_interface's People

Contributors

p208p2002 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

yamagg

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.