| 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) |
| }) |
| |
| test_that("wordEmbedding works", { |
| expect_equal(wordEmbedding("Test") %>% length, 200) |
| }) |
| |
| test_that("frequencyRank works", { |
| rank <- frequencyRank("Test") |
| expect_true(rank %>% is.numeric & rank > 0) |
| }) |