Marc Kupietz | dbd431a | 2021-08-29 12:17:45 +0200 | [diff] [blame^] | 1 | test_that("collocationScoreQuery works", { |
| 2 | kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE) |
| 3 | df <- collocationScoreQuery(kco, "Ameisenplage", "heimgesucht", leftContextSize=0, rightContextSize=1) |
| 4 | expect_gt(df$logDice, 1) |
| 5 | expect_equal(df$ll, ll(df$O1, df$O2, df$O, df$N, df$E, df$w)) |
| 6 | expect_equal(df$pmi, pmi(df$O1, df$O2, df$O, df$N, df$E, df$w)) |
| 7 | expect_equal(df$mi2, mi2(df$O1, df$O2, df$O, df$N, df$E, df$w)) |
| 8 | expect_equal(df$mi3, mi3(df$O1, df$O2, df$O, df$N, df$E, df$w)) |
| 9 | expect_equal(df$logDice, logDice(df$O1, df$O2, df$O, df$N, df$E, df$w)) |
| 10 | }) |
| 11 | |
| 12 | test_that("collocationAnalysis works", { |
| 13 | kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE) |
| 14 | df <- collocationAnalysis(kco, "Ameisenplage", leftContextSize=0, rightContextSize=1, topCollocatesLimit=1, exactFrequencies=FALSE) |
| 15 | expect_gt(df$O, df$E) |
| 16 | expect_gt(df$logDice, 1) |
| 17 | }) |
| 18 | |
| 19 | test_that("collocationAnalysis on unaccounted strings does not error out", { |
| 20 | kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE) |
| 21 | df <- collocationAnalysis(kco, "XXXXXXXXAmeisenplage") |
| 22 | testthat::expect_equal(nrow(df), 0) |
| 23 | }) |