blob: 91ec5d1d4a6428f5961fdfbfda005fe8088fae5a [file] [log] [blame]
isWord <- function(value) {
return (is.character(value) & nchar(value) >= 1)
}
test_that("paradigmatic neighbours works", {
expect_equal(paradigmaticNeighbours("Test")$word[1], "Test")
})
test_that("syntagmaticNeighbours works", {
expect_true(isWord(syntagmaticNeighbours("Test")$word[1]))
})
test_that("countbasedCollocates works", {
expect_true(isWord(countbasedCollocates("Test")$word[1]))
})
test_that("collocationScores works", {
expect_true(collocationScores("Zähne", "putzen")$f2[1] > 0)
})
test_that("cosineSimilarity works", {
expect_equal(cosineSimilarity("Test", "Test"), 1.0)
cosSim <- cosineSimilarity("Test", "testen")
expect_true(cosSim >= 0 & cosSim <= 1.0)
})