8965b34d036e7f81047d6ee9a1808e3140db9236,estnltk/ner.py,,json_document_to_estner_document,#Any#,67

Before Change


    estnltk.estner.ner.Document
        A ner document.
    
    estnerdoc = Document()
    for json_sent in jsondoc.split_by_sentences():
        snt = Sentence()
        zipped = list(zip(
            json_sent.word_texts,
            json_sent.lemmas,
            json_sent.root_tokens,
            json_sent.forms,
            json_sent.endings,
            json_sent.postags))
        json_toks = [{TEXT: text, LEMMA: lemma, ROOT_TOKENS: root_tokens, FORM: form, ENDING: ending, POSTAG: postag}
                     for text, lemma, root_tokens, form, ending, postag in zipped]
        // add labels, if they are present
        for tok, word in zip(json_toks, json_sent.words):
            if LABEL in word:
                tok[LABEL] = word[LABEL]
        for json_tok in json_toks:
            token = json_token_to_estner_token(json_tok)
            snt.append(token)
            estnerdoc.tokens.append(token)
        if snt:
            for i in range(1, len(snt)):
                snt[i-1].next = snt[i]
                snt[i].prew = snt[i-1]
            estnerdoc.snts.append(snt)
    return estnerdoc

After Change


                snt[i - 1].next = snt[i]
                snt[i].prew = snt[i - 1]
            sentences.append(snt)
    return Document(sentences=sentences)


def json_token_to_estner_token(json_token):
    Convert a JSON-style word token to an estner token.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: estnltk/estnltk
Commit Name: 8965b34d036e7f81047d6ee9a1808e3140db9236
Time: 2016-11-11
Author: alex.tk.fb@gmail.com
File Name: estnltk/ner.py
Class Name:
Method Name: json_document_to_estner_document


Project Name: estnltk/estnltk
Commit Name: 8965b34d036e7f81047d6ee9a1808e3140db9236
Time: 2016-11-11
Author: alex.tk.fb@gmail.com
File Name: estnltk/ner.py
Class Name:
Method Name: json_document_to_estner_document


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 7c3bebd23bbf2ac266aa543d73b959e5bcb77068
Time: 2017-07-28
Author: dizcology@hotmail.com
File Name: language/cloud-client/v1beta2/snippets.py
Class Name:
Method Name: entity_sentiment_text


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 7c3bebd23bbf2ac266aa543d73b959e5bcb77068
Time: 2017-07-28
Author: dizcology@hotmail.com
File Name: language/cloud-client/v1beta2/snippets.py
Class Name:
Method Name: entity_sentiment_file