Exemplo n.º 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
Exemplo n.º 2
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
Exemplo n.º 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.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)