Could you change this to print in the same format as the standard forest-extractor program?
For example:
x0 "is" x1 ||| x0 "wa" x1 "desu" ||| 1.0
(where 1.0 is the rule count)