GithubHelp home page GithubHelp logo

cjre's Introduction

CJRE

Install

$ pip install -U git+https://github.com/p208p2002/cjre.git

Basic Usage

import cjre
from cjre import CJRE_jieba, CJRE_ckip, CJRE_hybrid

if __name__ == "__main__":
    print(cjre)
    
    # use jieba
    cjre = CJRE_jieba()

    # use ckip
    # CJRE_ckip.download_model() # download the model on first time
    # cjre = CJRE_ckip(disable_cuda=False)

    # use hybrid
    # CJRE_hybrid.download_model() # download the model on first time
    # cjre = CJRE_hybrid()

    with open('test.txt','r',encoding='utf-8') as f:
        text = f.read().replace('\r\n','\n')
    
    # flags: https://github.com/fxsjy/jieba
    triple_res = cjre.extract_triple_res(text, stopwords=[])
    for triple_re in triple_res:
        print('-'.join(triple_re))
context: 
中華民國108年,王曉明造成王小美發生意外,王小美告王曉明

results:
王曉明-造成-王小美
王小美-告-王曉明

API

cjre.CJRE_jieba

def __init__(self, extra_dictionary_path=None):
def tagger(self, text=''):
def extract_triple_res(self, text, stopwords=[], relation_flags=['v.*','V.*'], split_by=','):

cjre.CJRE_ckip

def __init__(self, ckip_data_path = './data', custom_dict_path=None, disable_cuda=True, cuda_memory_limit=2048):
@staticmethod 
def download_model(from_gd=False):
def tagger(self, text=''):
def extract_triple_res(self, text, stopwords=[], relation_flags=['v.*','V.*'], split_by=','):

cjre.CJRE_hybrid

def __init__(self, ckip_data_path = './data', custom_dict_path=None, disable_cuda=True, cuda_memory_limit=2048):
@staticmethod 
def download_model(from_gd=False):
def tagger(self, text=''):
def extract_triple_res(self, text, stopwords=[], relation_flags=['v.*','V.*'], split_by=','):

cjre's People

Contributors

p208p2002 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  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.