def __call__(self, doc):
    text = urllib.parse.quote_plus(doc.text)
    result = urllib.request.urlopen((self.url + text)).read()
    annotationset = ET.fromstring(result).find('AnnotationSet')
    for annotation in annotationset.getchildren():
        if (annotation.get('Type') != 'Token'):
            continue
        word_index = int(annotation.get('StartNode'))
        word = self.get_word_from_annotation(annotation)
        for feature in annotation.getchildren():
            if (feature.find('Name').text == 'anas'):
                token = self.get_token_by_idx(word_index, doc)
                anas = (feature.find('Value').text if (feature.find('Value').text is not None) else '')
                token._.morph = set(anas.split(';'))
                token._.lemma = self.get_lemma_from_morph(anas)
                break
    return doc
def __call__(self, doc):
    text = urllib.parse.quote_plus(doc.text)
    result = urllib.request.urlopen((self.url + text)).read()
    annotationset = ET.fromstring(result).find('AnnotationSet')
    for annotation in annotationset.getchildren():
        if (annotation.get('Type') != 'Token'):
            continue
        word_index = int(annotation.get('StartNode'))
        word = self.get_word_from_annotation(annotation)
        for feature in annotation.getchildren():
            if (feature.find('Name').text == 'anas'):
                token = self.get_token_by_idx(word_index, doc)
                anas = (feature.find('Value').text if (feature.find('Value').text is not None) else )
                token._.morph = set(anas.split(';'))
                token._.lemma = self.get_lemma_from_morph(anas)
                break
    return doc