View Source Akin.SubstringSet (Akin v0.2.0)

Functions for string comparsion where common words between the strings are compared in sets.

Two sets

#MapSet<["alice", "in", "wonderland"]> #MapSet<["adventures", "alice", "glass", "looking", "s", "the", "through"]>

Commonality

  • common_words = "alice"
  • common_words_plus_remaining_words_left = "aliceinwonderland"
  • common_words_plus_remaining_words_right = "aliceadventuresglasslookingsthethrough"

Ratio is based on difference in string length

  • if words are of similar in length according to Akin.Strategy.determine/2
    • ratio is String.jaro_distance
  • if words are of dissimilar in length according to Akin.Strategy.determine/2
    • ratio is Akin.SubstringComparison.similarity/2 @ratio scale (determined by Akin.Strategy)

Match level is based on opt :level

  • "normal" returns average ratio
  • "weak" returns maximum ratio

Summary

Functions

Link to this function

compare(corpus1, corpus2, opts \\ [])

View Source
@spec compare(
  %Akin.Corpus{
    list: term(),
    original: term(),
    set: term(),
    stems: term(),
    string: term()
  },
  %Akin.Corpus{
    list: term(),
    original: term(),
    set: term(),
    stems: term(),
    string: term()
  },
  Keyword.t()
) :: float()

Callback implementation for Akin.Task.compare/3.