Content deleted Content added
m Upper and lower indices made so |
No edit summary |
||
Line 3:
The scaled probability measure was first proposed by [[Bridle]]. An early algorithm to solve this problem, [[sliding window]], was proposed by Wilpon et.al., 1989, with constant cost T=mn<sup>2</sup>/2.
A faster algorithm was developed by Silaghi in
== The Algorithm ==
Line 11:
<pre>
(int, int, int) SilaghiBridleDistance(char s[1..n], char t[1..m], int d[1..n,1..m]) {
declare int d'[1..n,0..(m+1)] //▼
// are not normally needed in an optimized implementation
▲ declare int s'[0..(n+1)] // these structures replicate the parameters and
declare int
declare int
for j := 1 to m // initialize data structure (can be optimized out)▼
// score, subsequence start, subsequence end
declare int e, B, E
for j := 1 to m
t'[j] := t[j]
for i := 1 to n
d'[i,j] := d[i,j]
for i := 1 to n do s'[i] := s
t'[0] := t'[m+1] := s'[0] := s'[n+1] := 'e'
// now the algorithm
for i := 1 to n do d'[i,0] := d'[i,m+1] := e
(e, B, E) := ViterbiDistance(s', t', d')/(E-B+1)
return (e, B, E)
|