distance: Compute distance

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/distance.r

Description

Computes distance metrics for two single words

Usage

1
distance(x,y,method="euclidean",tvectors=tvectors,breakdown=TRUE)

Arguments

x

A single word, given as a character of length(x) = 1

y

A single word, given as a character of length(y) = 1

method

Specifies whether to compute euclidean or cityblock metric

tvectors

the semantic space in which the computation is to be done (a numeric matrix where every row is a word vector)

breakdown

if TRUE, the function breakdown is applied to the input

Details

Computes Minkowski metrics, i.e. geometric distances between the vectors for two given words. Possible options are euclidean for the Euclidean Distance, d(x,y) = √{∑{(x-y)^2}}, and cityblock for the City Block metric, d(x,y) = ∑{|x-y|}

Value

The distance value as a numeric

Author(s)

Fritz G?nther

See Also

Cosine asym

Examples

1
2
3
data(wonderland)

distance("alice","rabbit",method="euclidean",tvectors=wonderland)

codymarquart/LSAfun2 documentation built on May 12, 2017, 8:43 a.m.