文字列編集距離 (レーベンシュタイン距離) を使用して、アイ トラッキング実験のスキャンパスを比較しています。(現在stringdist
、Rでパッケージを使用しています)
基本的に文字列の文字は、6x4 マトリックスの (注視) 位置を表します。マトリックスは次のように構成されています。
[,1] [,2] [,3] [,4]
[1,] 'a' 'g' 'm' 's'
[2,] 'b' 'h' 'n' 't'
[3,] 'c' 'i' 'o' 'u'
[4,] 'd' 'j' 'p' 'v'
[5,] 'e' 'k' 'q' 'w'
[6,] 'f' 'l' 'r' 'x'
基本的なレーベンシュタイン距離を使用して文字列を比較するa
と、文字列内の と の比較は との比較g
と同じ推定値にa
なりx
ます。
例えば:
'abc' compared to 'agc' -> 1
'abc' compared to 'axc' -> 1
これは、文字列が等しく (異なる) 類似していることを意味します。
マトリックスに隣接性を組み込む方法で、文字列比較に重みを付けたいと思います。たとえば、 と の間の距離は、 と の間の距離a
よりx
も大きく重み付けする必要がa
ありg
ます。
One way could be to calculate the "walk" (horizontal and vertial steps) from one letter to the other in the matrix and divide by the max "walk"-distance (i.e. from a
to x
). E.g. the "walk"-distance from a
to g
would be 1 and from a
to x
it would be 8 resulting in a weight of 1/8 and 1 respectively.
Is there a way to implement this (in either R or python)?