Skip to main content

NLP human utils

Project description

:rocket: iNLP :facepunch:


Install

  • pip install iNLP or pip install git+https://github.com/Jie-Yuan/iNLP.git

Usage

inlp.convert

  • 简繁体转换
from inlp.convert import chinese

chinese.s2t('忧郁的台湾乌龟') # chinese.simple2tradition('忧郁的台湾乌龟')
chinese.t2s('憂郁的臺灣烏龜') # chinese.tradition2simple('憂郁的臺灣烏龜')
  • 全角半角转换
from inlp.convert import char

char.half2full("0123456789")
char.full2half("0123456789")

inlp.explode

  • 汉字拆成字
from inlp.explode import Chars

Chars().get_chars('袁') # ['土 口 衣']
  • 汉字拆成笔画
from inlp.explode import Strokes

Strokes().get_strokes('袁') # ['一', '丨', '一', '丨', 'フ', '一', 'ノ', 'フ', 'ノ', '丶']

inlp.similarity

  • 基于词库的相似度
from inlp.similarity import thesaurus

s1 = ['周杰伦', '是', '一个', '歌手']
s2 = ['刘若英', '是', '个', '演员']

thesaurus.cilin(s1, s2) # 基于词林的相似度
thesaurus.hownet(s1, s2) # 基于知网的相似度
  • 基于hash的相似度
from inlp.similarity import simhash

simhash(s1, s2)

计划:增加基于词向量相似词相似句的方法

Project details


Release history Release notifications

This version

0.0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for iNLP, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size iNLP-0.0.2-py3-none-any.whl (2.3 MB) File type Wheel Python version py3 Upload date Hashes View
Filename, size iNLP-0.0.2.tar.gz (62.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page