q9uri commited on
Commit ·
de1981d
1
Parent(s): d9c8421
add jieba dict
Browse files- src/zh/jieba/COPYING +53 -0
- src/zh/jieba/char.def +147 -0
- src/zh/jieba/convert_to_jtalk.py +13 -0
- src/zh/jieba/convert_to_lex_csv.py +16 -0
- src/zh/jieba/dict.txt +0 -0
- src/zh/jieba/lex.csv +3 -0
- src/zh/jieba/matrix.def +2 -0
- src/zh/jieba/unk.def +11 -0
src/zh/jieba/COPYING
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
chr.def, unk.def licence
|
| 3 |
+
Copyright (c) 2001-2008, Taku Kudo
|
| 4 |
+
Copyright (c) 2004-2008, Nippon Telegraph and Telephone Corporation
|
| 5 |
+
All rights reserved.
|
| 6 |
+
|
| 7 |
+
Redistribution and use in source and binary forms, with or without modification, are
|
| 8 |
+
permitted provided that the following conditions are met:
|
| 9 |
+
|
| 10 |
+
* Redistributions of source code must retain the above
|
| 11 |
+
copyright notice, this list of conditions and the
|
| 12 |
+
following disclaimer.
|
| 13 |
+
|
| 14 |
+
* Redistributions in binary form must reproduce the above
|
| 15 |
+
copyright notice, this list of conditions and the
|
| 16 |
+
following disclaimer in the documentation and/or other
|
| 17 |
+
materials provided with the distribution.
|
| 18 |
+
|
| 19 |
+
* Neither the name of the Nippon Telegraph and Telegraph Corporation
|
| 20 |
+
nor the names of its contributors may be used to endorse or
|
| 21 |
+
promote products derived from this software without specific
|
| 22 |
+
prior written permission.
|
| 23 |
+
|
| 24 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
| 25 |
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
| 26 |
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
| 27 |
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 28 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 29 |
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
| 30 |
+
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
| 31 |
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 32 |
+
|
| 33 |
+
dict.txt license
|
| 34 |
+
The MIT License (MIT)
|
| 35 |
+
|
| 36 |
+
Copyright (c) 2013 Sun Junyi
|
| 37 |
+
|
| 38 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
| 39 |
+
this software and associated documentation files (the "Software"), to deal in
|
| 40 |
+
the Software without restriction, including without limitation the rights to
|
| 41 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
| 42 |
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
| 43 |
+
subject to the following conditions:
|
| 44 |
+
|
| 45 |
+
The above copyright notice and this permission notice shall be included in all
|
| 46 |
+
copies or substantial portions of the Software.
|
| 47 |
+
|
| 48 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 49 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
| 50 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
| 51 |
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
| 52 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
| 53 |
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
src/zh/jieba/char.def
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# Japanese charcter category map
|
| 3 |
+
#
|
| 4 |
+
# $Id: char.def,v 1.3 2006/04/08 06:41:36 taku-ku Exp $;
|
| 5 |
+
#
|
| 6 |
+
|
| 7 |
+
###################################################################################
|
| 8 |
+
#
|
| 9 |
+
# CHARACTER CATEGORY DEFINITION
|
| 10 |
+
#
|
| 11 |
+
# CATEGORY_NAME INVOKE GROUP LENGTH
|
| 12 |
+
#
|
| 13 |
+
# - CATEGORY_NAME: Name of category. you have to define DEFAULT class.
|
| 14 |
+
# - INVOKE: 1/0: always invoke unknown word processing, evan when the word can be found in the lexicon
|
| 15 |
+
# - GROUP: 1/0: make a new word by grouping the same chracter category
|
| 16 |
+
# - LENGTH: n: 1 to n length new words are added
|
| 17 |
+
#
|
| 18 |
+
DEFAULT 0 1 0 # DEFAULT is a mandatory category!
|
| 19 |
+
SPACE 0 1 0
|
| 20 |
+
KANJI 0 1 0
|
| 21 |
+
SYMBOL 1 1 0
|
| 22 |
+
NUMERIC 1 1 0
|
| 23 |
+
ALPHA 1 1 0
|
| 24 |
+
HIRAGANA 0 1 0
|
| 25 |
+
KATAKANA 1 1 0
|
| 26 |
+
KANJINUMERIC 1 1 0
|
| 27 |
+
GREEK 1 1 0
|
| 28 |
+
CYRILLIC 1 1 0
|
| 29 |
+
|
| 30 |
+
###################################################################################
|
| 31 |
+
#
|
| 32 |
+
# CODE(UCS2) TO CATEGORY MAPPING
|
| 33 |
+
#
|
| 34 |
+
|
| 35 |
+
# SPACE
|
| 36 |
+
0x0020 SPACE # DO NOT REMOVE THIS LINE, 0x0020 is reserved for SPACE
|
| 37 |
+
0x00D0 SPACE
|
| 38 |
+
0x0009 SPACE
|
| 39 |
+
0x000B SPACE
|
| 40 |
+
0x000A SPACE
|
| 41 |
+
|
| 42 |
+
# ASCII
|
| 43 |
+
0x0021..0x002F SYMBOL
|
| 44 |
+
0x0030..0x0039 NUMERIC
|
| 45 |
+
0x003A..0x0040 SYMBOL
|
| 46 |
+
0x0041..0x005A ALPHA
|
| 47 |
+
0x005B..0x0060 SYMBOL
|
| 48 |
+
0x0061..0x007A ALPHA
|
| 49 |
+
0x007B..0x007E SYMBOL
|
| 50 |
+
|
| 51 |
+
# Latin
|
| 52 |
+
0x00A1..0x00BF SYMBOL # Latin 1
|
| 53 |
+
0x00C0..0x00FF ALPHA # Latin 1
|
| 54 |
+
0x0100..0x017F ALPHA # Latin Extended A
|
| 55 |
+
0x0180..0x0236 ALPHA # Latin Extended B
|
| 56 |
+
0x1E00..0x1EF9 ALPHA # Latin Extended Additional
|
| 57 |
+
|
| 58 |
+
# CYRILLIC
|
| 59 |
+
0x0400..0x04F9 CYRILLIC
|
| 60 |
+
0x0500..0x050F CYRILLIC # Cyrillic supplementary
|
| 61 |
+
|
| 62 |
+
# GREEK
|
| 63 |
+
0x0374..0x03FB GREEK # Greek and Coptic
|
| 64 |
+
|
| 65 |
+
# HIRAGANA
|
| 66 |
+
0x3041..0x309F HIRAGANA
|
| 67 |
+
|
| 68 |
+
# KATAKANA
|
| 69 |
+
0x30A1..0x30FF KATAKANA
|
| 70 |
+
0x31F0..0x31FF KATAKANA # Small KU .. Small RO
|
| 71 |
+
# 0x30FC KATAKANA HIRAGANA # ��
|
| 72 |
+
0x30FC KATAKANA
|
| 73 |
+
|
| 74 |
+
# Half KATAKANA
|
| 75 |
+
0xFF66..0xFF9D KATAKANA
|
| 76 |
+
0xFF9E..0xFF9F KATAKANA
|
| 77 |
+
|
| 78 |
+
# KANJI
|
| 79 |
+
0x2E80..0x2EF3 KANJI # CJK Raidcals Supplement
|
| 80 |
+
0x2F00..0x2FD5 KANJI
|
| 81 |
+
0x3005 KANJI
|
| 82 |
+
0x3007 KANJI
|
| 83 |
+
0x3400..0x4DB5 KANJI # CJK Unified Ideographs Extention
|
| 84 |
+
0x4E00..0x9FA5 KANJI
|
| 85 |
+
0xF900..0xFA2D KANJI
|
| 86 |
+
0xFA30..0xFA6A KANJI
|
| 87 |
+
|
| 88 |
+
# KANJI-NUMERIC (�� �� �� �� �� ϻ �� Ȭ �� �� ɴ �� �� �� ��)
|
| 89 |
+
0x4E00 KANJINUMERIC KANJI
|
| 90 |
+
0x4E8C KANJINUMERIC KANJI
|
| 91 |
+
0x4E09 KANJINUMERIC KANJI
|
| 92 |
+
0x56DB KANJINUMERIC KANJI
|
| 93 |
+
0x4E94 KANJINUMERIC KANJI
|
| 94 |
+
0x516D KANJINUMERIC KANJI
|
| 95 |
+
0x4E03 KANJINUMERIC KANJI
|
| 96 |
+
0x516B KANJINUMERIC KANJI
|
| 97 |
+
0x4E5D KANJINUMERIC KANJI
|
| 98 |
+
0x5341 KANJINUMERIC KANJI
|
| 99 |
+
0x767E KANJINUMERIC KANJI
|
| 100 |
+
0x5343 KANJINUMERIC KANJI
|
| 101 |
+
0x4E07 KANJINUMERIC KANJI
|
| 102 |
+
0x5104 KANJINUMERIC KANJI
|
| 103 |
+
0x5146 KANJINUMERIC KANJI
|
| 104 |
+
|
| 105 |
+
# ZENKAKU
|
| 106 |
+
0xFF10..0xFF19 NUMERIC
|
| 107 |
+
0xFF21..0xFF3A ALPHA
|
| 108 |
+
0xFF41..0xFF5A ALPHA
|
| 109 |
+
0xFF01..0xFF0F SYMBOL
|
| 110 |
+
0xFF1A..0xFF1F SYMBOL
|
| 111 |
+
0xFF3B..0xFF40 SYMBOL
|
| 112 |
+
0xFF5B..0xFF65 SYMBOL
|
| 113 |
+
0xFFE0..0xFFEF SYMBOL # HalfWidth and Full width Form
|
| 114 |
+
|
| 115 |
+
# OTHER SYMBOLS
|
| 116 |
+
0x2000..0x206F SYMBOL # General Punctuation
|
| 117 |
+
0x2070..0x209F NUMERIC # Superscripts and Subscripts
|
| 118 |
+
0x20A0..0x20CF SYMBOL # Currency Symbols
|
| 119 |
+
0x20D0..0x20FF SYMBOL # Combining Diaritical Marks for Symbols
|
| 120 |
+
0x2100..0x214F SYMBOL # Letterlike Symbols
|
| 121 |
+
0x2150..0x218F NUMERIC # Number forms
|
| 122 |
+
0x2100..0x214B SYMBOL # Letterlike Symbols
|
| 123 |
+
0x2190..0x21FF SYMBOL # Arrow
|
| 124 |
+
0x2200..0x22FF SYMBOL # Mathematical Operators
|
| 125 |
+
0x2300..0x23FF SYMBOL # Miscellaneuos Technical
|
| 126 |
+
0x2460..0x24FF SYMBOL # Enclosed NUMERICs
|
| 127 |
+
0x2501..0x257F SYMBOL # Box Drawing
|
| 128 |
+
0x2580..0x259F SYMBOL # Block Elements
|
| 129 |
+
0x25A0..0x25FF SYMBOL # Geometric Shapes
|
| 130 |
+
0x2600..0x26FE SYMBOL # Miscellaneous Symbols
|
| 131 |
+
0x2700..0x27BF SYMBOL # Dingbats
|
| 132 |
+
0x27F0..0x27FF SYMBOL # Supplemental Arrows A
|
| 133 |
+
0x27C0..0x27EF SYMBOL # Miscellaneous Mathematical Symbols-A
|
| 134 |
+
0x2800..0x28FF SYMBOL # Braille Patterns
|
| 135 |
+
0x2900..0x297F SYMBOL # Supplemental Arrows B
|
| 136 |
+
0x2B00..0x2BFF SYMBOL # Miscellaneous Symbols and Arrows
|
| 137 |
+
0x2A00..0x2AFF SYMBOL # Supplemental Mathematical Operators
|
| 138 |
+
0x3300..0x33FF SYMBOL
|
| 139 |
+
0x3200..0x32FE SYMBOL # ENclosed CJK Letters and Months
|
| 140 |
+
0x3000..0x303F SYMBOL # CJK Symbol and Punctuation
|
| 141 |
+
0xFE30..0xFE4F SYMBOL # CJK Compatibility Forms
|
| 142 |
+
0xFE50..0xFE6B SYMBOL # Small Form Variants
|
| 143 |
+
|
| 144 |
+
# added 2006/3/13
|
| 145 |
+
0x3007 SYMBOL KANJINUMERIC
|
| 146 |
+
|
| 147 |
+
# END OF TABLE
|
src/zh/jieba/convert_to_jtalk.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
data = Path("./lex.csv").read_text(encoding="utf-8")
|
| 4 |
+
out = []
|
| 5 |
+
for line in data.split("\n"):
|
| 6 |
+
split_line = line.split(",")
|
| 7 |
+
surface = split_line[0]
|
| 8 |
+
cost = split_line[1]
|
| 9 |
+
pos = split_line[4]
|
| 10 |
+
out_line = f"{surface},{cost},0,0,{pos},*,*,*,*,*,{surface},{surface},{surface},*/*,*"
|
| 11 |
+
out.append(out_line)
|
| 12 |
+
|
| 13 |
+
Path("./zh-jibea-noacc.csv").write_text("\n".join(out), encoding="utf8")
|
src/zh/jieba/convert_to_lex_csv.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
data = Path("./dict.txt").read_text(encoding="utf8")
|
| 4 |
+
|
| 5 |
+
out = []
|
| 6 |
+
for line in data.split("\n"):
|
| 7 |
+
if line != "":
|
| 8 |
+
split_line = line.split(" ")
|
| 9 |
+
surface = split_line[0]
|
| 10 |
+
cost = split_line[1]
|
| 11 |
+
pos = split_line[2]
|
| 12 |
+
|
| 13 |
+
out_line = f"{surface},{cost},0,0,{pos}"
|
| 14 |
+
out.append(out_line)
|
| 15 |
+
|
| 16 |
+
Path("./lex.csv").write_text("\n".join(out), encoding="utf8")
|
src/zh/jieba/dict.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/zh/jieba/lex.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7334c2737110e5f9cf5d40299cc9ecdaffaf2bd2a102c0da6723e0a8c6adf304
|
| 3 |
+
size 6817080
|
src/zh/jieba/matrix.def
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1 1
|
| 2 |
+
0 0 0
|
src/zh/jieba/unk.def
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
DEFAULT,0,0,0,*
|
| 2 |
+
SPACE,0,0,0,*
|
| 3 |
+
KANJI,0,0,0,*
|
| 4 |
+
SYMBOL,0,0,0,*
|
| 5 |
+
NUMERIC,0,0,0,*
|
| 6 |
+
ALPHA,0,0,0,*
|
| 7 |
+
HIRAGANA,0,0,0,*
|
| 8 |
+
KATAKANA,0,0,0,*
|
| 9 |
+
KANJINUMERIC,0,0,0,*
|
| 10 |
+
GREEK,0,0,0,*
|
| 11 |
+
CYRILLIC,0,0,0,*
|