Find nearest-matching string from a set

Computes shortest distance between a key string and a set of strings to find the nearest match.

現在この提出コンテンツをフォロー中です。

Uses a modified Vagner-Fischer algorithm to find the Levenshtein distance between each pair of strings. Progressively narrows the threshold to equal the distance of the best match found so far, reducing run time.

Updated to correct the algorithm. (sorry!)

Optional behaviors include an upper-bound threshold distance, detect first or multiple matches of equal distance, case insensitivity.

Examples:

>> [i,d]=strnearest({'first string'},{'string 2','abcdefgh','FURSrtd','firststring'})

i =

[4]

d =

2

>> [i,d]=strnearest({'1','first string'},{'string 2','abcdefgh','1st string','FURSrtd','seconaaad string','2'})

i =

[6] [3]

d =

1 5

>>

引用

Brandon Kuczenski (2026). Find nearest-matching string from a set (https://jp.mathworks.com/matlabcentral/fileexchange/36981-find-nearest-matching-string-from-a-set), MATLAB Central File Exchange. に取得済み.

謝辞

ヒントを得たファイル: Calculation of distance between strings

カテゴリ

Help Center および MATLAB AnswersCharacters and Strings についてさらに検索

一般的な情報

MATLAB リリースの互換性

  • すべてのリリースと互換性あり

プラットフォームの互換性

  • Windows
  • macOS
  • Linux
バージョン 公開済み リリース ノート Action
1.2.0.0

Updated to correct an error in the code and to add working examples to the description.

1.1.0.0

Add link to strdist.m

1.0.0.0