Sorry but theres a problem with the code. For example consider 2nd line of you output. Its giving double probablity in third column (E.E)
M6: M6<-Q, E.E, IV_32
Whereas according to the __DATA__ M6 is coming directly from Q
M6 Q E
Thus correct output should be :-
M6: M6<-Q, E, II_15
To give you an intuition this line in data means that the probability of M6 coming from Q is 'E'. That is what I want in third column. If suppose M6 were coming from M76 which in turn comes from Q M6<-M76<-Q and the input data for these were
__DATA__
M6 M76 E
M76 Q E
Then in this case M6: M6<-M76<-Q, E.E, IV_32 would have been a correct output.
So basically the third column is giving wront output, due to which fourth column is also giving incorrect results as it is based on third for its input.