Skip to contents

MoverScore n-gram distance and Sentence Mover's Distance (Eq 8.11, 8.14)

Usage

morie_kamath_ch8_moverscore_distance(x_i, y_j, E = NULL)

morie_kamath_ch8_smd(x, y, E = NULL)

Arguments

x_i, y_j

Embeddings, or objects for E.

E

Optional embedder.

x, y

Sentence embeddings.

Value

List with estimate, difference.

Details

One L2 distance serves both Python modules exactly as km126 calls km123: km123 -> morie_kamath_ch8_moverscore_distance, km126 -> morie_kamath_ch8_smd.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_kamath_ch8_moverscore_distance(V, V)
#> $estimate
#> [1] 0
#> 
#> $difference
#> [1] 0 0 0 0 0 0 0 0
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "MoverScore Euclidean n-gram distance (Kamath Eq 8.11)"
#>