from pattern.en import parsetree
s = parsetree('The dog slept on the floor', relations=True, lemmata=True)
print repr(s)
Code returns output as below
[Sentence('The/DT/B-NP/O/NP-SBJ-1/the dog/NN/I-NP/O/NP-SBJ-1/dog slept/VBD/B-VP/O/VP-1/sleep on/IN/B-PP/B-PNP/O/on the/DT/B-NP/I-PNP/O/the floor/NN/I-NP/I-PNP/O/floor')]
How to draw a parse tree for it? Is it possible to change it into penn tree bank format and send it to nltk and draw a parse tree?
Aucun commentaire:
Enregistrer un commentaire