Marc Kupietz | 41b0f68 | 2022-07-21 15:32:45 +0200 | [diff] [blame] | 1 | using Artifacts |
Marc Kupietz | 7101f9e | 2022-07-21 08:58:19 +0200 | [diff] [blame] | 2 | using DerekoVecs |
| 3 | using Test |
| 4 | |
Marc Kupietz | 41b0f68 | 2022-07-21 15:32:45 +0200 | [diff] [blame] | 5 | |
Marc Kupietz | 7101f9e | 2022-07-21 08:58:19 +0200 | [diff] [blame] | 6 | @testset "DerekoVecs.jl" begin |
Marc Kupietz | 41b0f68 | 2022-07-21 15:32:45 +0200 | [diff] [blame] | 7 | |
| 8 | wpd19 = load(joinpath(artifact"wpd19_10000", "wpd19_10000", "wpd19_10000.vecs")) |
| 9 | |
| 10 | @testset "DerekoVecs.jl: loading" begin |
| 11 | @test wpd19.m == 200; |
| 12 | @test wpd19.n >= 10000; |
| 13 | end |
| 14 | |
| 15 | @testset "DerekoVecs.jl: similarities" begin |
| 16 | @test isapprox(DerekoVecs.cos_sim(wpd19, "war", "war"), 1) |
| 17 | @test cos_sim(wpd19, "wurden", "war") == cos_sim(wpd19, "war", "wurden") |
| 18 | @test cos_sim(wpd19, "wurde", "wurden") > cos_sim(wpd19, "wurde", "ich") |
| 19 | @test cos_sim(wpd19, "wurden", "war") == cos_sim(wpd19, wpd19, "war", "wurden") |
Marc Kupietz | 438a18a | 2022-07-22 09:24:12 +0200 | [diff] [blame^] | 20 | @test isapprox(cos_sim(wpd19, wpd19, "war"), 1) |
| 21 | @test isapprox(cos_sim(wpd19, wpd19, 50), 1) |
| 22 | @test isapprox(cos_sim(wpd19, 50, 50), 1) |
Marc Kupietz | 41b0f68 | 2022-07-21 15:32:45 +0200 | [diff] [blame] | 23 | end |
| 24 | |
| 25 | @testset "DerekoVecs.jl: knn" begin |
| 26 | @test "dieser" in knn(wpd19, "der", 3) |
| 27 | @test "wurden" in knn(wpd19, "wurde", 3) |
| 28 | end |
| 29 | |
Marc Kupietz | 7101f9e | 2022-07-21 08:58:19 +0200 | [diff] [blame] | 30 | end |