blob: 91ec5d1d4a6428f5961fdfbfda005fe8088fae5a [file] [log] [blame]
Marc Kupietzd8cc9822023-10-20 07:10:22 +02001isWord <- function(value) {
2 return (is.character(value) & nchar(value) >= 1)
3}
4
5test_that("paradigmatic neighbours works", {
6 expect_equal(paradigmaticNeighbours("Test")$word[1], "Test")
7})
8
9test_that("syntagmaticNeighbours works", {
10 expect_true(isWord(syntagmaticNeighbours("Test")$word[1]))
11})
12
13test_that("countbasedCollocates works", {
14 expect_true(isWord(countbasedCollocates("Test")$word[1]))
15})
16
17test_that("collocationScores works", {
18 expect_true(collocationScores("Zähne", "putzen")$f2[1] > 0)
19})
20
21test_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})