Ejemplo n.º 1
0
def handle_words_or_word(words):
        assert type(words) == list
        if len(words) == 0:
            return ""
        if len(words) == 1:
            ts_pos = dict_api.lookup_ts_pos_force(words[0])
            return make_beauty_1_word(ts_pos)
        else:
            return handle_words(words)
Ejemplo n.º 2
0
def handle_words(words):
    assert type(words) == list
    assert len(words) > 1
    words_external = []
    for word in words:
        if len(word) > 2:
            words_external.append(dict_api.lookup_ts_pos_force(word))

    pos = ""
    for word in words_external:
        if word["pos"]:
            pos = word["pos"]
            break
    for word in words_external:
        if word["pos"] and word["pos"] != pos:
            pos = ""
            break

    return make_beauty_some_words(words_external, pos)