LoginSignup
8
0

More than 1 year has passed since last update.

String.jaro_distance/2 (Elixir)

Last updated at Posted at 2020-12-21

この記事はElixir その2 Advent Calendar 2020 22日目です。


はじめに

  • Elixir楽しんでいますか:bangbang:

String.jaro_distance/2

  • この関数、知っていますか
  • 2つの文字列がどのくらい似ているかを0.0〜1.0の間で評価するものだそうです

Computes the Jaro distance (similarity) between two strings.
Returns a float value between 0.0 (equates to no similarity) and 1.0 (is an exact match) representing Jaro distance between string1 and string2.

具体例

iex> String.jaro_distance("awesome", "awesome")
1.0
iex> String.jaro_distance("cat", "fish")     
0.0
iex> String.jaro_distance("osamu", "awesome")  
0.565079365079365
iex> String.jaro_distance("osamu", "ozamu") 
0.8666666666666667
iex> String.jaro_distance("erlang", "elixir")
0.5555555555555555
iex> String.jaro_distance("ruby", "elixir")  
0.0
  • だいたい動きはわかりました
  • $\huge{で!? 何に使うのジャロ?}$

実例のご紹介【2022-03-18 追記】

読者の方から実例についてのお便りをいただきました。
ここに御礼を申し上げるとともに、追記にて実例のご紹介をしておきます。

SurfaceDid you mean?機能で使っているとのことです。

スクリーンショット 2022-03-18 18.52.21.png

読者の方というのは、 @mnishiguchi さんのことです!
elixir.jp Slackの#autoracexチャンネルにてご連絡いただきました。
Thanks a lot!!!です。

Wrapping Up :christmas_tree::santa::santa_tone1::santa_tone2::santa_tone3::santa_tone4::santa_tone5::christmas_tree:

8
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
0