コード例 #1
0
ファイル: home_stemming.php プロジェクト: abbeet/server39
<?php

$kalimat = file_get_contents('home_text.txt', true);
if (@$_POST['submit']) {
    $kalimat = $_REQUEST['kalimat'];
    $kata = tokenising($kalimat);
    $hasil = filtering($kata, "id");
    echo '<strong>Kalimat :</strong>' . '<br>';
    echo $kalimat . '<br><br>';
    //--------- hasil Stemming --------------------
    echo '<font color=blue> Hasil Stemming </font>' . '<br>';
    $n = count($hasil);
    for ($i = 0; $i < $n; $i++) {
        $term = stemming($hasil[$i]);
        echo 'kata ke ' . ($i + 1) . ' ' . $hasil[$i] . ' ==> hasil : <strong>' . stemming($hasil[$i]) . '</strong><br>';
    }
    echo '<strong>Jumlah kata ada : ' . $n . '</strong><br>';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
		<title>Stemming</title>
	</head>
	
	<body>
		<p><strong>SIMULASI PROSES STEMMING </strong></p>
		<p>Masukkan kata/kalimat:</p>
		<form method="post">
コード例 #2
0
ファイル: uji_dokumen.php プロジェクト: abbeet/server39
 $opsi_bm25 = $baris['mode_bm25'];
 $opsi_decision = $baris['mode_decision'];
 $opsi_persen = $baris['min_persen'];
 $opsi_language = $baris['cross_language'];
 if ($opsi_tfidf == 1 and $opsi_bm25 != 1) {
     $pilihan = 1;
 } elseif ($opsi_tfidf != 1 and $opsi_bm25 == 1) {
     $pilihan = 2;
 } elseif ($opsi_tfidf == 1 and $opsi_bm25 == 1) {
     $pilihan = 3;
 } else {
     $pilihan = 4;
 }
 // end of opsi uji
 $kata = tokenising($file_query);
 $hasil = filtering($kata, $bahasa);
 // calculate tf berdasarkan stemming masing2 bahasa
 if ($bahasa == "id") {
     $doc_terms_id = calculate_tf($hasil);
     if ($opsi_language == 1) {
         foreach ($doc_terms_id as $k => $f) {
             $translate = mysql_query("select word from trans_id_en where kata = '{$k}'");
             $terjemahan = mysql_fetch_array($translate);
             $word = $terjemahan[0];
             if ($word != "") {
                 $doc_terms_en[$word] = $f;
             } else {
                 $doc_terms_en[$k] = $f;
             }
         }
     }