t[3] = gender_to_replace
    if(t[0] == "noun") :
        t[0] = "subst"
    for tag in t :
        new_tags += tag + ":"
    return new_tags.strip(":")

def change_word() :
    pass

input_file = "/home/tusia/Desktop/magisterka/sample_texts/1.txt"
try :
    text = ""
    tok = "text.txt"
    call_toki(input_file, tok)
    sentences = parse_toki_output(tok)
    word = "korpus"
    word_versions = [word, word.capitalize()]
    prepared_sentences = tag(sentences, "offline", "WCRFT")
    tags = get_tags(word_versions[0], prepared_sentences)
    mark_sentences_with_searched_word(word_versions[0], prepared_sentences)
    mark_sentences_with_searched_word(word_versions[1], prepared_sentences)
    mark_sentences_with_ppron_coreference(word_versions[0], tags, prepared_sentences)
    word_sub = "podstawa"
    possibilities = get_possibilities(word_sub)
    poss_list = parse_morfeusz_output(possibilities)
    tagged = tag_word(word_sub, "online", "WCRFT")
    word_sub_tags = tagged.values()[0][0]
    gender = word_sub_tags.split(":")[3]
    for sentence in prepared_sentences :
        if(sentence[2]) :
Example #2
0
        return tags[0]
    elif (tags[1] > tags_capitalized[1]) :
        return  tags_capitalized[0]
    elif (tags_capitalized[1] > tags[1]) :
        return tags[0]
    else :
        return ""

print "Automatyczne dopasowywanie wartości kategorii gramatycznych w polskich tekstach"
print "wersja 1.0"
input_file = str(input("\t > Podaj ścieżkę do pliku z tekstem \n\t > "))
try :
    print(check_if_file_exists(input_file))
    tokenized_file = "sentenced.txt"
    call_toki(input_file, tokenized_file)
    sentences = parse_toki_output(tokenized_file)
    word = str(input("\t > Podaj słowo, które chcesz znaleźć w tekście\n\t > \t"))
    word_versions = [word, word.capitalize()]
    version = str(input("\t > Podaj wersję taggera, z której chcesz korzystać: online lub offline \n \t > "))
    if(not(check_version(version))) :
        raise IOError("\t > Podałeś złą wersję. Dopuszczalne formy to 'online' lub 'offline'")
    tagger = ""
    if (version == "offline") :
        tagger = "none"
    elif (version == "online") :
        tagger = str(input("\t > Podaj tagger, z którego chcesz skorzystać. Dostępne narzędzia: WCFT, WMBT, Polita, Pantera, Concraft \n \t > "))
        if(not(check_tagger(tagger))) :
            raise IOError("\t > Podałeś złą nazwę taggera. Dopuszczalne formy to: WCFT, WMBT, Polita, Pantera, Concraft")
    prepared_sentences = tag(sentences, version, tagger)
    tags = get_tags(word_versions[0], prepared_sentences)
    mark_sentences_with_searched_word(word_versions[0], prepared_sentences)