Exceptions must be Text_Bayes_Exception extended from PEAR_Exception. Further exception classes should be used for different classes of errors.
Quote usage is inconsistent. I see no use of inlined variables so ' should be used for consistency.
There should be spaces around all = and +, etc. and a space after every ;. Ex:
for ($i=1;$i<=floor($freedom / 2);$i++)
for ($i = 1; $i <= floor($freedom / 2); $i++)
I don't understand why so many definitions are used, especially for values which are used once internally, such as: