blob: d007f4edd6e52934d3b0e4ae6070047d193426f6 [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)
})
test_that("wordEmbedding works", {
expect_equal(wordEmbedding("Test") %>% length, 200)
})
test_that("frequencyRank works", {
rank <- frequencyRank("Test")
expect_true(rank %>% is.numeric & rank > 0)
})
test_that("wordFrequency works", {
freq <- wordFrequency("Test")
expect_true(freq %>% is.numeric & freq > 0)
})
test_that("corpusSize works", {
size <- corpusSize()
expect_true(size %>% is.numeric & size > 1000)
})