Marc Kupietz | d8cc982 | 2023-10-20 07:10:22 +0200 | [diff] [blame] | 1 | isWord <- function(value) { |
| 2 | return (is.character(value) & nchar(value) >= 1) |
| 3 | } |
| 4 | |
| 5 | test_that("paradigmatic neighbours works", { |
| 6 | expect_equal(paradigmaticNeighbours("Test")$word[1], "Test") |
| 7 | }) |
| 8 | |
| 9 | test_that("syntagmaticNeighbours works", { |
| 10 | expect_true(isWord(syntagmaticNeighbours("Test")$word[1])) |
| 11 | }) |
| 12 | |
| 13 | test_that("countbasedCollocates works", { |
| 14 | expect_true(isWord(countbasedCollocates("Test")$word[1])) |
| 15 | }) |
| 16 | |
| 17 | test_that("collocationScores works", { |
| 18 | expect_true(collocationScores("Zähne", "putzen")$f2[1] > 0) |
| 19 | }) |
| 20 | |
| 21 | test_that("cosineSimilarity works", { |
| 22 | expect_equal(cosineSimilarity("Test", "Test"), 1.0) |
| 23 | cosSim <- cosineSimilarity("Test", "testen") |
| 24 | expect_true(cosSim >= 0 & cosSim <= 1.0) |
| 25 | }) |