Contents

distance(between:and:distanceType:)

Calculates the distance between two strings in the vocabulary space.

Declaration

@nonobjc func distance(between firstString: String, and secondString: String, distanceType: NLDistanceType = .cosine) -> NLDistance

Parameters

  • firstString:

    A string in the embedding vocabulary.

  • secondString:

    Another string in the embedding vocabulary.

  • distanceType:

    A means of calculating distance that determines which formula the method uses to evaluate the distance between firstString and secondString.

Return Value

The distance associated with distanceType.

See Also

Finding strings and their distances in an embedding