Berkeley Neural Parser

Constituency Parsing with a Self-Attentive Encoder (ACL 2018)

A Python implementation of the parsers described in "Constituency Parsing with a Self-Attentive Encoder" from ACL 2018.


import spacy from benepar.spacy_plugin import BeneparComponent nlp = spacy.load('en') nlp.add_pipe(BeneparComponent('benepar_en')) doc = nlp(u'The time for action is now. It's never too late to do something.') sent = list(doc.sents)[0] print(sent._.parse_string) # (S (NP (NP (DT The) (NN time)) (PP (IN for) (NP (NN action)))) (VP (VBZ is) (ADVP (RB now))) (. .)) print(sent._.labels) # ('S',) print(list(sent._.children)[0]) # The time for action
View more
Author info

Nikita Kitaev


Categories research pipeline

Submit your project

If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the project idea label on the issue tracker.

Read the docsJSON source