Skip to main content

: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)

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

Release files for iNLP 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iNLP 0.0.2
File Size Uploaded
iNLP-0.0.2.tar.gz 62.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iNLP 0.0.2
File Interpreter ABI Platform
iNLP-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 2.4 MB

Release files / iNLP-0.0.2.tar.gz

Download URL iNLP-0.0.2.tar.gz
Size 62.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dc011ab2334f8f59a8974cbbebb684317ad5b9436d2d9b23ff9b5211e22824dc
BLAKE2b-256 checksum
How to use checksums
31a2fc50899c08517dbad42044ee74d6a7d2266620d24657e7a6150ab2de2a8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / iNLP-0.0.2-py3-none-any.whl

Download URL iNLP-0.0.2-py3-none-any.whl
Size 2.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
806c20ed37e985c5e75cabefa0edf1bd90f16debdfe6984ecce0778a7a478b57
BLAKE2b-256 checksum
How to use checksums
8c8a734f46ef7cb96ea286dd860b48acc7d83ea98dd923b2560f1523c70a72a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page