Automating Hierarchical Task Network Learning