Research Article

A Grammar-Based Semantic Similarity Algorithm for Natural Language Sentences

Algorithm 3

Grammarmatrix.
INPUT: ,  /* sets of sub-relations of sentences A, B, where  */
OUTPUT:   /* elements of the Grammar Vector of sentences A, B in linking type i */
(1)   COL MAX( , )
(2)   ROW MIN( , )
(3)  FOR ALL     COL  DO
(4)  FOR ALL     ROW  DO
(5)   MAX( [x], Wu_Palmer( , ))
(6)  END FOR
(7)  END FOR
(8)  FOR  0  TO 
(9)   +
(10)  END FOR
(11)   Pow( )
(12)  RETURN