def __call__(self, text):
    'Convert a StanfordNLP Doc to a spaCy Doc.\n\n        text (unicode): The text to process.\n        RETURNS (spacy.tokens.Doc): The spaCy Doc object.\n        '
    snlp_doc = self.snlp(text)
    text = snlp_doc.text
    (tokens, heads) = self.get_tokens_with_heads(snlp_doc)
    if (not len(tokens)):
        raise ValueError('No tokens available.')
    words = []
    spaces = []
    pos = []
    tags = []
    deps = []
    lemmas = []
    offset = 0
    is_aligned = self.check_aligned(text, tokens)
    for (i, token) in enumerate(tokens):
        span = text[offset:]
        if (not len(span)):
            break
        while (len(span) and span[0].isspace()):
            offset += 1
            span = text[offset:]
        words.append(token.text)
        pos.append(self.vocab.strings.add((token.upos or '')))
        tags.append(self.vocab.strings.add((token.xpos or '')))
        deps.append(self.vocab.strings.add((token.dependency_relation or '')))
        lemmas.append(self.vocab.strings.add((token.lemma or '')))
        offset += len(token.text)
        span = text[offset:]
        if (i == (len(tokens) - 1)):
            spaces.append(False)
        elif (not is_aligned):
            spaces.append(True)
        else:
            next_token = tokens[(i + 1)]
            spaces.append((not span.startswith(next_token.text)))
    attrs = [POS, TAG, DEP, HEAD]
    array = numpy.array(list(zip(pos, tags, deps, heads)), dtype='uint64')
    doc = Doc(self.vocab, words=words, spaces=spaces).from_array(attrs, array)
    lemma_array = numpy.array([[lemma] for lemma in lemmas], dtype='uint64')
    doc.from_array([LEMMA], lemma_array)
    if (any(pos) and any(tags)):
        doc.is_tagged = True
    if any(deps):
        doc.is_parsed = True
    return doc
Convert a StanfordNLP Doc to a spaCy Doc.

text (unicode): The text to process.
RETURNS (spacy.tokens.Doc): The spaCy Doc object.
def __call__(self, text):
    'Convert a StanfordNLP Doc to a spaCy Doc.\n\n        text (unicode): The text to process.\n        RETURNS (spacy.tokens.Doc): The spaCy Doc object.\n        '
    snlp_doc = self.snlp(text)
    text = snlp_doc.text
    (tokens, heads) = self.get_tokens_with_heads(snlp_doc)
    if (not len(tokens)):
        raise ValueError('No tokens available.')
    words = []
    spaces = []
    pos = []
    tags = []
    deps = []
    lemmas = []
    offset = 0
    is_aligned = self.check_aligned(text, tokens)
    for (i, token) in enumerate(tokens):
        span = text[offset:]
        if (not len(span)):
            break
        while (len(span) and span[0].isspace()):
            offset += 1
            span = text[offset:]
        words.append(token.text)
        pos.append(self.vocab.strings.add((token.upos or )))
        tags.append(self.vocab.strings.add((token.xpos or )))
        deps.append(self.vocab.strings.add((token.dependency_relation or )))
        lemmas.append(self.vocab.strings.add((token.lemma or )))
        offset += len(token.text)
        span = text[offset:]
        if (i == (len(tokens) - 1)):
            spaces.append(False)
        elif (not is_aligned):
            spaces.append(True)
        else:
            next_token = tokens[(i + 1)]
            spaces.append((not span.startswith(next_token.text)))
    attrs = [POS, TAG, DEP, HEAD]
    array = numpy.array(list(zip(pos, tags, deps, heads)), dtype='uint64')
    doc = Doc(self.vocab, words=words, spaces=spaces).from_array(attrs, array)
    lemma_array = numpy.array([[lemma] for lemma in lemmas], dtype='uint64')
    doc.from_array([LEMMA], lemma_array)
    if (any(pos) and any(tags)):
        doc.is_tagged = True
    if any(deps):
        doc.is_parsed = True
    return doc