-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from mrchypark/add-rule
add minimal replacer
- Loading branch information
Showing
5 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
test_that("add rule works", { | ||
skip_if_offline() | ||
if (!model_works("small")) | ||
get_model("small") | ||
|
||
kw <- kiwi_init_(kiwi_model_path_full("small"), 0, BuildOpt$DEFAULT) | ||
res1<- kiwi_analyze_wrap(kw, "했어요! 하잖아요! 할까요?", top_n = 1) | ||
res2<- kiwi_analyze_wrap(kw, "했어용! 하잖아용! 할까용?", top_n = 1) | ||
|
||
expect_false(identical(res1[[1]]$Score, res2[[1]]$Score)) | ||
|
||
kb <- kiwi_builder_init_(kiwi_model_path_full("small"), 0, BuildOpt$DEFAULT) | ||
kiwi_builder_add_rule_(kb, "ef", "요$", "용", -2) | ||
kw <- kiwi_builder_build_(kb) | ||
res<- kiwi_analyze_wrap(kw, "했어용! 하잖아용! 할까용?") | ||
expect_false(identical(res1[[1]]$Score, res[[1]]$Score)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters