Skip to content

Commit 2b204f6

Browse files
authored
Merge pull request #198 from bab2min/dev/saisiot
사이시옷 분석 기능 추가
2 parents e371e0d + 2901ad8 commit 2b204f6

File tree

19 files changed

+512
-364
lines changed

19 files changed

+512
-364
lines changed

ModelGenerator/morphemes.txt

Lines changed: 298 additions & 296 deletions
Large diffs are not rendered by default.

include/kiwi/Form.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ namespace kiwi
109109
/**< 선행형태소의 모음조화 조건 */
110110
CondPolarity polar() const { return static_cast<CondPolarity>((vpPack >> 4) & 0x7); }
111111

112+
/**< 추가 분석이 가능한 형태소인지(파생어나 사이시옷이 포함된 합성명사 등) */
112113
bool complex() const { return !!(vpPack & 0x80); }
113114

114115
void setVowel(CondVowel v)
@@ -141,8 +142,9 @@ namespace kiwi
141142
const KString* kform = nullptr;
142143
POSTag tag = POSTag::unknown;
143144
CondVowel vowel : 4;
144-
CondPolarity polar : 3;
145+
CondPolarity polar : 2;
145146
bool complex : 1;
147+
bool saisiot : 1;
146148
uint8_t senseId = 0;
147149
uint8_t combineSocket = 0;
148150
int32_t combined = 0;
@@ -205,7 +207,8 @@ namespace kiwi
205207
CondVowel vowel = CondVowel::none;
206208
CondPolarity polar = CondPolarity::none;
207209
uint8_t formHash = 0;
208-
uint8_t zCodaAppendable = 0;
210+
uint8_t zCodaAppendable : 1;
211+
uint8_t zSiotAppendable : 1;
209212

210213
Form();
211214
~Form();
@@ -251,7 +254,7 @@ namespace kiwi
251254
* @param morphBase 형태소 배열의 시작 위치
252255
* @return 최적화된 형태 정보
253256
*/
254-
Form bake(const FormRaw& o, const Morpheme* morphBase, bool zCodaAppendable, const Vector<uint32_t>& additionalCands = {});
257+
Form bake(const FormRaw& o, const Morpheme* morphBase, bool zCodaAppendable, bool zSiotAppendable, const Vector<uint32_t>& additionalCands = {});
255258

256259
/**
257260
* @brief 변경 가능한 형태소 정보를 bake하여 최적화한다.

include/kiwi/PatternMatcher.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ namespace kiwi
2525
splitComplex = 1 << 22, /**< 더 작은 단위로 분할될 수 있는 형태소는 더 분할하여 매칭한다 */
2626
zCoda = 1 << 23, /**< 어미 및 조사에 덧붙은 받침이 있는 경우 이를 분리하여 z_coda 태그로 매칭한다 */
2727
compatibleJamo = 1 << 24, /**< 출력시 한글 첫가끝 자모를 호환가능한 자모로 변환한다. */
28+
splitSaisiot = 1 << 25, /**< 사이시옷이 포함된 합성명사를 분리하여 매칭한다. */
29+
mergeSaisiot = 1 << 26, /**< 사이시옷이 포함된 것으로 추정되는 명사를 결합하여 매칭한다. */
2830
joinVSuffix = joinVerbSuffix | joinAdjSuffix,
2931
joinAffix = joinNounPrefix | joinNounSuffix | joinVerbSuffix | joinAdjSuffix | joinAdvSuffix,
3032
all = url | email | hashtag | mention | serial | emoji | zCoda,

include/kiwi/TagUtils.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ namespace kiwi
3131
{
3232
return POSTag::jks <= tag && tag <= POSTag::jc;
3333
}
34-
34+
35+
inline bool isNNClass(POSTag tag)
36+
{
37+
return POSTag::nng <= tag && tag <= POSTag::nnb;
38+
}
39+
3540
inline bool isSuffix(POSTag tag)
3641
{
3742
tag = clearIrregular(tag);

include/kiwi/Types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ namespace kiwi
211211
w_url, w_email, w_mention, w_hashtag, w_serial, w_emoji,
212212
jks, jkc, jkg, jko, jkb, jkv, jkq, jx, jc,
213213
ep, ef, ec, etn, etm,
214-
z_coda,
214+
z_coda, z_siot,
215215
user0, user1, user2, user3, user4,
216216
p, /**< 분할된 동사/형용사를 나타내는데 사용됨 */
217217
max, /**< POSTag의 총 개수를 나타내는 용도 */
@@ -275,7 +275,7 @@ namespace kiwi
275275
* @brief 선행 형태소의 양/음성 조건(모음 조화)과 관련된 열거형
276276
*
277277
*/
278-
enum class CondPolarity : char
278+
enum class CondPolarity : uint8_t
279279
{
280280
none, /**< 조건이 설정되지 않음 */
281281
positive, /**< 선행 형태소가 양성(ㅏ,ㅑ,ㅗ)인 경우만 등장 가능 */

models/base/default.dict

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
# * (점수)는 생략시 0으로 처리됩니다.
1818
# 예) 사겼다 사귀/VV + 었/EP + 다/EF -1.0
1919
#
20-
# 현재는 공백을 포함하는 다어절 형태를 등록할 수 없습니다.
21-
#
2220
# <규칙 기반의 변형된 이형태를 추가하는 경우>
2321
# (형태 규칙)$ \t (변형된 형태/품사태그) \t (점수)
2422
# 예) 요$ 용/EF -5

models/base/sj.knlm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:52d50761ed4aeea82e3be9f6fbb4724b75f526e56368bdc76dd530049ef9a07e
3-
size 35828400
2+
oid sha256:00f93f6abdc6bc31b3995c063564ffd558c475c2e5f5ea1e2ac38b64b4e06842
3+
size 35836336

models/base/sj.morph

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:1c8a9999841059a00ef2c76dc190f651e698c0516209da524930c9818f01279c
3-
size 3581294
2+
oid sha256:125fb05ad20c0d8d7ebb45591b8acaadcea0e740197aceff1ee2d14e8c8195e4
3+
size 3586754

models/base/skipbigram.mdl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:ae4f0ee268f516bf4dfe282337f8773ab900ce081fefc1167b5c29259b1c465b
3-
size 3186444
2+
oid sha256:3f5239d9542be89970c454336538375c8c59df2a678988ab79c512bed2301e78
3+
size 3186448

models/base/typo.dict

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
편찬 편찮/VA -5
1616
귀찬 귀찮/VA -5
1717
하찬 하찮/VA -5
18+
시끄러 시끄럽/VA-I + 어/EF -5

0 commit comments

Comments
 (0)