0

ROOT からトークンへの依存関係のパスを抽出しますか? スペイシー。パス全体を抽出するコード

import spacy

sentence = "I saw the man with a telescop"

nlp = spacy.load('en')
doc = nlp(sentence)

for sent in doc.sents:
    for token in sent:
        print("{}\t{}\t{}\t{}".format(token.i, token.text, token.head, token.dep_))
4

1 に答える 1