cky parsing algorithm to learn parse trees and generate them for test strings