All Projects → peterolson → hanzi-tools

peterolson / hanzi-tools

Licence: Unlicense license
Converts from Chinese characters to pinyin, between simplified and traditional, and does word segmentation.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to hanzi-tools

ToJyutping
粵語拼音自動標註工具 Cantonese Pronunciation Automatic Labeling Tool
Stars: ✭ 30 (-56.52%)
Mutual labels:  traditional-chinese, simplified-chinese, chinese-characters
Opencc
Conversion between Traditional and Simplified Chinese
Stars: ✭ 5,979 (+8565.22%)
Mutual labels:  traditional-chinese, simplified-chinese
hanzi-pinyin-font
Chinese font displaying Hanzi (汉字) characters with by transliteration/pronunciation (Pīnyīn).
Stars: ✭ 79 (+14.49%)
Mutual labels:  pinyin, chinese-characters
wasm-opencc
OpenCC compiled by Emscripten so that you can run it on browsers or nodejs without compiling.
Stars: ✭ 41 (-40.58%)
Mutual labels:  traditional-chinese, simplified-chinese
discussion
記錄有關繁化姬的議題或是內容
Stars: ✭ 33 (-52.17%)
Mutual labels:  traditional-chinese, simplified-chinese
Sublime-Fanhuaji
繁化姬的 Sublime Text 插件
Stars: ✭ 48 (-30.43%)
Mutual labels:  traditional-chinese, simplified-chinese
pinyin
an R package for converting Chineses characters into pinyin
Stars: ✭ 45 (-34.78%)
Mutual labels:  pinyin, chinese-characters
IntroductionToCalculus
一版使用XeLaTeX整理過的精排版的微積溯源
Stars: ✭ 19 (-72.46%)
Mutual labels:  traditional-chinese
sylbreak
Syllable segmentation tool for Myanmar language (Burmese) by Ye.
Stars: ✭ 44 (-36.23%)
Mutual labels:  word-segmentation
CJK-character-count
Program that counts the amount of CJK characters based on Unicode ranges and Chinese encoding standards 字体汉字计数软件
Stars: ✭ 195 (+182.61%)
Mutual labels:  chinese-characters
react-flashcards
A simple React + Firebase flashcard application
Stars: ✭ 29 (-57.97%)
Mutual labels:  chinese-characters
chinese-rhymer
轻量中文押韵神器,100%绝对可用,傻瓜式命令行操作,秒速实现烈焰单押,闪电双押,龙卷三押以及海啸式四押,目前版本 v0.2.6。Search for rhymes for Chinese words, with 1, 2, 3 and 4 characters, released on PyPI with current version of 0.2.6.
Stars: ✭ 72 (+4.35%)
Mutual labels:  pinyin
ToolGood.Words.Core
一款高性能敏感词(非法词/脏字)检测过滤组件,附带繁体简体互换,支持全角半角互换,汉字转拼音,模糊搜索等功能。支持.net standard 2.0
Stars: ✭ 66 (-4.35%)
Mutual labels:  pinyin
crnn.mxnet
crnn in mxnet.can train with chinese characters
Stars: ✭ 47 (-31.88%)
Mutual labels:  chinese-characters
dnn-lstm-word-segment
Chinese Word Segmention Base on the Deep Learning and LSTM Neural Network
Stars: ✭ 24 (-65.22%)
Mutual labels:  word-segmentation
skt
Sanskrit compound segmentation using seq2seq model
Stars: ✭ 21 (-69.57%)
Mutual labels:  word-segmentation
Pytorch-NLU
Pytorch-NLU,一个中文文本分类、序列标注工具包,支持中文长文本、短文本的多类、多标签分类任务,支持中文命名实体识别、词性标注、分词等序列标注任务。 Ptorch NLU, a Chinese text classification and sequence annotation toolkit, supports multi class and multi label classification tasks of Chinese long text and short text, and supports sequence annotation tasks such as Chinese named entity recognition, part of speech ta…
Stars: ✭ 151 (+118.84%)
Mutual labels:  word-segmentation
codeprep
A toolkit for pre-processing large source code corpora
Stars: ✭ 39 (-43.48%)
Mutual labels:  word-segmentation
pytorch Joint-Word-Segmentation-and-POS-Tagging
Paper: A Simple and Effective Neural Model for Joint Word Segmentation and POS Tagging
Stars: ✭ 37 (-46.38%)
Mutual labels:  word-segmentation
Printed-Chinese-Character-OCR
This is a Chinese Character ocr system based on Deep learning (VGG like CNN neural net work),this rep include trainning set generating,image preprocesing,NN model optimizing based on Keras high level NN framwork
Stars: ✭ 21 (-69.57%)
Mutual labels:  chinese-characters

Hanzi Tools 汉字工具

《汉字工具》是四种工具的集合。 Hanzi Tools is a collection of four different tools.

  • segment - 分词。 Divide text into words.
  • pinyinify - 转换汉字为拼音。 Convert Chinese characters to pinyin.
  • simplify - 转换简体汉字为繁体汉字。 Convert traditional characters to simplified characters.
  • traditionalize - 转换繁体汉字为简体汉字。 Convert simplified characters to traditional characters.
  • tag - 词性标注。 Part-of-speech tagging.

安装 Installation

npm install hanzi-tools

segment

分词。 Divide text into words.

var segment = require("hanzi-tools").segment;

segment("我在青岛市崂山区工作。");
// [ '我', '在', '青岛市', '崂山区', '工作', '。' ]

pinyinify

转换汉字为拼音。 Convert Chinese characters to pinyin.

var pinyinify = require("hanzi-tools").pinyinify;

pinyinify("转换汉字为拼音。")
// "zhuǎnhuàn hànzì wéi pīnyīn."

console.log(pinyinify("你好!你今天吃饭了没?"));
// nǐhǎo! nǐ jīntiān chīfàn le méi?

详细输出 Detailed output

pinyinify("人人生而自由,在尊严和权利上一律平等。", true)
// { 
//   segments: ['人人', '生而自由', ',', '在', '尊严', '和', '权利', '上', '一律平等', '。'],
//   pinyinSegments: ['rénrén', 'shēngérzìyóu', ',', 'zài', 'zūnyán', 'hé', 'quánlì', 'shàng', 'yīlǜpíngděng', '.'],
//   pinyinSegmentsSyllables: [['rén', 'rén'], ['shēng', 'ér', 'zì', 'yóu'], [','], ['zài'], ['zūn', 'yán'], ['hé'], ['quán', 'lì'], ['shàng'], ['yī', 'lǜ', 'píng', 'děng', '.']],
//   pinyin: 'rénrén shēngérzìyóu, zài zūnyán hé quánlì shàng yīlǜpíngděng.' 
// }

simplify

转换简体汉字为繁体汉字。 Convert traditional characters to simplified characters.

var simplify = require("hanzi-tools").simplify;
simplify("有朋自遠方來,不亦樂乎?");
// 有朋自远方来,不亦乐乎?

traditionalize

转换繁体汉字为简体汉字。 Convert simplified characters to traditional characters.

var traditionalize = require("hanzi-tools").traditionalize;
traditionalize("起来!不愿做奴隶的人们! 把我们的血肉,筑成我们新的长城!");
// 起來!不願做奴隸的人們! 把我們的血肉,築成我們新的長城!

tag

词性标注。 Part-of-speech tagging.

    var tag = require("hanzi-tools").tag;
    tag("你是我最喜欢的人。");
    // [ { word: '你', tag: 'r' },
    // { word: '是', tag: 'v' },
    //  { word: '我', tag: 'r' },
    //  { word: '最', tag: 'd' },
    //  { word: '喜欢', tag: 'v' },
    //  { word: '的', tag: 'uj' },
    //  { word: '人', tag: 'n' },
    //  { word: '。', tag: 'x' } ]

词性编码表 Part-of-speech codes

代码 Code 名称 Meaning 举例 Example
a 形容词 Adjective 冰箱很脏
ad 副形词 Adverbial adjective 你一直努力工作。
ag 形语素 Adjectival morpheme
an 名形词 Nounal adjective 现在没有危险了。
b 区别词 Attributive 所有鸟都会飞吗?
c 连词 Conjunction 你不我吻别吗?
d 副词 Adverb 没收到他的信。
df 副词不要 Adverb "不要" 不要客气。
dg 副语素 Adverbial morpheme 尽管证据在,他们却装作好象没插手这事。
e 叹词 Interjection 你干什么呢 不想活了?
f 方位词 Location word 我从梦醒来。
g 语素 Isolated morpheme
h 前缀 Prefix 工作人员禁止入内。
i 成语 Idiom 不快乐不请自来
j 简称略语 Abbreviation 日本办过多少次奥运会
k 后缀 Suffix 亲爱的朋友
l 习用语 Idiomatic phrase 我累得再也走不动了。
m 数词 Quantity 我怀孕四个月了。
mq 数量词 Measure word 这件事你告诉他妈没?
n 名词 Noun 电池快没电了。
ng 名语素 Noun morpheme 你看着像
nr 人名 Name of a person 我一出门就碰上老王了。
nrfg 汉语名字 Chinese name 中国国家主席习近平会见美国国务卿约翰·克里。
nrt 音译人名 Transliterated name 彼得看起来很年轻。
ns 地名 Place name 伦敦现在七点了。
nt 机构团体 Group name 我自愿加入中国共产党
nz 其他专名 Other proper nouns 他会讲一点点英语
o 拟声词 Onomatopoeia 我的肚子在咕咕叫。
p 介词 Preposition 你保证。
q 量词 Isolated measure word 我不是老师。
r 代词 Pronoun 明白的意思吗?
rg 代词性语素 Pronoun-like morpheme 向大会转递委员会的此份报告。
rr 人称代词 Personal pronoun 不用担心其他人
rz 指示代词 Demonstrative pronoun 这位女士应该知道!
s 处所词 Place word 天下没有免费的午餐。
t 时间词 Time word 今天可能会来。
tg 时语素 Time morpheme 一会就能明白。
u 助词 Function word 如果可能的话
ud 结构助词得 Structural particle "得" 他玩很好。
ug 时态助词过 Temporal particle "过" 我见你的女朋友。
uj 结构助词的 Structural particle "的" 他们是我兄弟。
ul 时态助词了 Temporal particle "了" 已经很完美
uv 结构助词地 Structural particle "地" 请安静关门。
uz 时态助词着 Temporal particle "着" 让土地闲置很浪费。
v 动词 Verb ,我发现了这个!
vd 副动词 Adverbial form of verb 只能持续十五分钟。
vg 动词性语素 Verb-like morpheme 我每周游一次。。
vi 不及物动词 Intransitive verb 乌克兰经济上等同于失败的国家。
vn 名动词 Noun-like verb 他习惯了旅行
vq 动词去过 Verb "去过" 去过罗马。
x 非语素字 Non-morpheme 。?!
y 语气词 Modal particle 你不会害怕
z 状态词 Status word 我还晕晕乎乎的。
zg 状态语素 Status morpheme 抱歉。
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].