File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -653,7 +653,8 @@ size_t kiwi::splitByTrie(
653
653
const auto scanStart = max (endPosMap[nBeginWithMultiplier].first , (uint32_t )1 ), scanEnd = endPosMap[nBeginWithMultiplier].second ;
654
654
const bool longestMatched = scanStart < scanEnd && any_of (out.begin () + scanStart, out.begin () + scanEnd, [&](const KGraphNode& g)
655
655
{
656
- return nBeginWithMultiplier == g.endPos && lastSpecialEndPos == g.endPos - (g.uform .empty () ? g.form ->sizeWithoutSpace () : g.uform .size ()) * posMultiplier;
656
+ const auto start = g.endPos - (g.uform .empty () ? g.form ->sizeWithoutSpace () : g.uform .size ()) * posMultiplier;
657
+ return nBeginWithMultiplier == g.endPos && (lastSpecialEndPos == start || specialStartPos == start);
657
658
});
658
659
659
660
// insert unknown form
Original file line number Diff line number Diff line change @@ -361,6 +361,18 @@ TEST(KiwiCpp, UserTag)
361
361
EXPECT_EQ (tokens[7 ].tag , POSTag::user2);
362
362
}
363
363
364
+ TEST (KiwiCpp, STagPrefix)
365
+ {
366
+ Kiwi& kiwi = reuseKiwiInstance ();
367
+ auto res = kiwi.analyze (u" 자신있는 지역은 `후분양`으로 나올듯 싶습니다." , Match::allWithNormalizing).first ;
368
+ EXPECT_EQ (res[0 ].str , u" 자신" );
369
+ EXPECT_EQ (res[1 ].str , u" 있" );
370
+ EXPECT_EQ (res[2 ].str , u" 는" );
371
+ EXPECT_EQ (res[3 ].str , u" 지역" );
372
+ EXPECT_EQ (res[4 ].str , u" 은" );
373
+ EXPECT_EQ (res[5 ].str , u" `" );
374
+ }
375
+
364
376
TEST (KiwiCpp, HSDataset)
365
377
{
366
378
KiwiBuilder kw{ MODEL_PATH, 0 , BuildOption::default_, };
You can’t perform that action at this time.
0 commit comments