Skip to content

Commit

Permalink
added test case for loadMultiDict
Browse files Browse the repository at this point in the history
  • Loading branch information
bab2min committed Feb 12, 2024
1 parent 7849efa commit c0a453d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,23 @@ TEST(KiwiCpp, SpaceTolerant)
kiwi.setSpacePenalty(8);
}

TEST(KiwiCpp, MultiWordDictionary)
{
auto& kiwi = reuseKiwiInstance();
const auto text = u"밀리언 달러 베이비랑 바람과 함께 사라지다랑 뭐가 더 재밌었어?";

auto res = kiwi.analyze(text, Match::allWithNormalizing).first;
EXPECT_EQ(res[0].str, u"밀리언 달러 베이비");
EXPECT_EQ(res[0].tag, POSTag::nnp);

EXPECT_EQ(res[2].str, u"바람과 함께 사라지다");
EXPECT_EQ(res[2].tag, POSTag::nnp);

auto kiwi2 = KiwiBuilder{ MODEL_PATH, 0, BuildOption::default_ & ~BuildOption::loadMultiDict, }.build();
res = kiwi2.analyze(text, Match::allWithNormalizing).first;
EXPECT_NE(res[0].str, u"밀리언 달러 베이비");
}

TEST(KiwiCpp, WordsWithSpaces)
{
KiwiBuilder kw{ MODEL_PATH, 0, BuildOption::default_, };
Expand Down

0 comments on commit c0a453d

Please sign in to comment.