Logo Spacy

spaCy: Dependency Parsing

  • syntactic dependency parser
  • API for navigating the tree
  • sentence boundary detection
  • iterate over base noun phrases, or “chunks”

Noun chunks

  • = base noun phrases – flat phrases that have a noun as their head
  • noun plus the words describing the noun:
the lavish green grass

or

the world’s largest tech fund
  • To get the noun chunks in a document, simply iterate over Doc.noun_chunks

Navigating the parse tree

import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("Autonomous cars shift insurance liability toward manufacturers")
for token in doc:
    print(
        token.text,
        token.dep_,
        token.head.text,
        token.head.pos_,
        [child for child in token.children]
    )
  • every word has exactly one head

 

Zdroje

  • https://spacy.io/usage/linguistic-features#dependency-parse

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *