From c0a453db7ff0441d82d1ccb0e6fb52ff15c9f28b Mon Sep 17 00:00:00 2001 From: bab2min Date: Mon, 12 Feb 2024 17:20:13 +0900 Subject: [PATCH] added test case for `loadMultiDict` --- test/test_cpp.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/test_cpp.cpp b/test/test_cpp.cpp index 46d8e440..6d0abb3a 100644 --- a/test/test_cpp.cpp +++ b/test/test_cpp.cpp @@ -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_, };