Beispiel #1
0
def cek_negasi_list(kunci_jawaban):
    if type(kunci_jawaban) is not list:
        kunci_jawaban = [kunci_jawaban]
    new_kj = list()
    for i in kunci_jawaban:
        i = nrm.ubah_simbol(i)
        # hasil = nrm.cek_negasi(kata_negasi,i)
        new_kj.append(nrm.cek_negasi(kata_negasi, i))
    return new_kj
Beispiel #2
0
def get_unik(kunci_jawaban):
    if type(kunci_jawaban) is not list:
        kunci_jawaban = [kunci_jawaban]
    list_kata_kj = list()
    for i in kunci_jawaban:
        i = nrm.ubah_simbol(i)
        for j in i.split():
            list_kata_kj.append(j)
    # list_kata_kj = list(set(list_kata_kj))
    return list(set(list_kata_kj))
Beispiel #3
0
def praproses(jawaban, kunci_jawaban_unik):
    jawaban = nrm.ubah_simbol(jawaban)
    jawaban = nrm.pisahKata(kunci_jawaban_unik, jawaban)
    jawaban = nrm.cek_typo(kunci_jawaban_unik, jawaban, 0.95)
    jawaban_ngram = ngram.en_geram(kunci_jawaban_unik, jawaban).split()
    #jawaban = jawaban +" "+ " ".join(list(set(jawaban_ngram.split())))
    jawaban = jawaban.split()
    for i in jawaban_ngram:
        if i not in jawaban:
            jawaban.append(i)
    jawaban = " ".join(jawaban)
    jawaban = nrm.cek_negasi(kata_negasi, jawaban)
    return jawaban
Beispiel #4
0
def praproses_(jawaban, kunci_jawaban_unik):
    jawaban = nrm.ubah_simbol(jawaban)
    jawaban = nrm.pisahKata(kunci_jawaban_unik, jawaban)
    jawaban = nrm.cek_typo(kunci_jawaban_unik, jawaban, 0.96)
    jawaban_ngram = ngram.en_geram(kunci_jawaban_unik, jawaban).split()
    # print("n-gram",jawaban_ngram)
    # jawaban = jawaban +" "+ " ".join(list(set(jawaban_ngram.split())))
    jawaban = jawaban.split()
    for i in jawaban_ngram:
        if i not in jawaban:
            jawaban.append(i)
    jawaban = " ".join(jawaban)
    # jawaban =  stp.stopwords(jawaban, corpus=corpus_stopword)
    # print(jawaban)
    return nrm.cek_negasi(kata_negasi, jawaban)