Exemplo n.º 1
0
def _reverse(doc, attr, rev_attr):
    for word in all_words(doc):
        if attr == "lex":
            for ana in word["Anas"]:
                val = ana["lex"]
                if val:
                    _insert_attr(word, rev_attr, val[::-1])
        elif attr == "form":
            val = word["Text"]
            if val:
                 _insert_attr(word, rev_attr, val[::-1])
Exemplo n.º 2
0
def _reverse(doc, attr, rev_attr):
    for word in all_words(doc):
        if attr == "lex":
            for ana in word["Anas"]:
                val = ana["lex"]
                if val:
                    _insert_attr(word, rev_attr, val[::-1])
        elif attr == "form":
            val = word["Text"]
            if val:
                _insert_attr(word, rev_attr, val[::-1])
Exemplo n.º 3
0
def set_capital(doc):
    for word in all_words(doc):
        if word["Text"] and word["Text"][0].isupper():
            _insert_flag(word, "capital")
Exemplo n.º 4
0
def normalize_punct(doc):
    for word in all_words(doc):
        word["Punct"] = _normalize_punct_str(word["Punct"])
    for sent in all_sents(doc):
        sent["Punct"] = _normalize_punct_str(sent["Punct"])
Exemplo n.º 5
0
def normalize_accents(doc):
    for word in all_words(doc):
        word["Text"] = normalize_accents_str(word["Text"])
Exemplo n.º 6
0
def normalize_punct(doc):
    for word in all_words(doc):
        word["Punct"] = _normalize_punct_str(word["Punct"])
    for sent in all_sents(doc):
        sent["Punct"] = _normalize_punct_str(sent["Punct"])
Exemplo n.º 7
0
def normalize_accents(doc):
    for word in all_words(doc):
        word["Text"] = normalize_accents_str(word["Text"])