blob: 25778cf468a0f25c09f3c89c58320e6e76c7125b [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})
„feldmueller“ff438632023-10-24 17:17:04 +020026
27test_that("wordEmbedding works", {
28 expect_equal(wordEmbedding("Test") %>% length, 200)
29})
30
31test_that("frequencyRank works", {
32 rank <- frequencyRank("Test")
33 expect_true(rank %>% is.numeric & rank > 0)
34})