Contents

distance(between:and:distanceType:)

Calculates the distance between two strings in the vocabulary space.

Declaration

func distance(between first: String, and second: String, distanceType: NLDistanceType = .cosine) -> Double

Parameters

  • first:

    A string in the embedding vocabulary.

  • second:

    Another string in the embedding vocabulary.

  • distanceType:

    The metric to use to calculate the distance between the first and second strings.

Return Value

The distance

See Also

Testing a word embedding