示例#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])
示例#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])
示例#3
0
def set_capital(doc):
    for word in all_words(doc):
        if word["Text"] and word["Text"][0].isupper():
            _insert_flag(word, "capital")
示例#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"])
示例#5
0
def normalize_accents(doc):
    for word in all_words(doc):
        word["Text"] = normalize_accents_str(word["Text"])
示例#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"])
def normalize_accents(doc):
    for word in all_words(doc):
        word["Text"] = normalize_accents_str(word["Text"])