私はCYK algorithmについて読んでいましたが、理解できない擬似コードの部分があります。全体の擬似コードは次のとおりです。CYKアルゴリズムの擬似コードを理解できません
let the input be a string S consisting of n characters: a1 ... an.
let the grammar contain r nonterminal symbols R1 ... Rr.
This grammar contains the subset Rs which is the set of start symbols.
let P[n,n,r] be an array of booleans. Initialize all elements of P to false.
for each i = 1 to n
for each unit production Rj -> ai
set P[i,1,j] = true
for each i = 2 to n -- Length of span
for each j = 1 to n-i+1 -- Start of span
for each k = 1 to i-1 -- Partition of span
for each production RA -> RB RC
if P[j,k,B] and P[j+k,i-k,C] then set P[j,i,A] = true
if any of P[1,n,x] is true (x is iterated over the set s, where s are all the indices for Rs) then
S is member of language
else
S is not member of language
これらの部品は、私は混乱していた、次のとおりです。
for each production RA -> RB RC
if P[j,k,B] and P[j+k,i-k,C] then set P[j,i,A] = true
誰かがこれらの擬似コードについていくつかのヒントを与えるだろうか?
@ syb0rg:私は意図的にインデントを残して、コードの大きな塊からコードの小さなスニペットを見つける方が簡単です。 – nhahtdh
@nhahtdh修正済み(習慣をフォーマットする、申し訳ありません)。 – syb0rg
@ syb0rg:小さなコードスニペットの字下げは少しオフです(元のコードからコピーして貼り付けるだけで済みます)。 – nhahtdh