gatenlp.lib_stanfordnlp module

Support for using stanfordnlp: convert from stanfordnlp output to gatenlp documents and annotations.

gatenlp.lib_stanfordnlp.apply_stanfordnlp(nlp, gatenlpdoc, setname='')[source]

Run the stanford nlp pipeline on the gatenlp document and transfer the annotations. This modifies the gatenlp document in place.

Parameters
  • nlp – StanfordNLP pipeline

  • gatenlpdoc – gatenlp document

  • setname – set to use

Returns

gatenlp.lib_stanfordnlp.stanfordnlp2gatenlp(stanfordnlpdoc, gatenlpdoc=None, setname='', word_type='Word', sentence_type='Sentence')[source]

Convert a StanfordNLP document to a gatenlp document. If a gatenlp document is already provided, add the annotations from the StanfordNLP document to it. In this case the original gatenlpdoc is used and gets modified. :param stanfordnlpdoc: a StanfordNLP document :param gatenlpdoc: if None, a new gatenlp document is created otherwise this document is added to. :param setname: the annotation set name to which the annotations get added, empty string for the default annotation set. :param token_type: the annotation type to use for tokens :param sentence_type: the annotation type to use for sentence anntoations :return: the new or modified