need to write the algorithm for the given data

the description of the project is in the project1 part 2 pdf. you need to  write the code to retrieve the script to form the  goal nodes from foon.text. we have given the sample outputs in the sample output folder presented in the zip file.  two output files should be formed for each goal node(the description of these files is given in project 1 part 2).