示例#1
0
<?php

#include("../../includes/dbh.php");
#include("../../includes/functions.php");
#include("../../includes/func_stemming.php");
$kalimat = file_get_contents('home_text.txt', true);
if (@$_POST['submit']) {
    $kalimat = $_REQUEST['kalimat'];
    $kata = tokenising($kalimat);
    $jml_kata = count($kata);
    echo '<strong>Kalimat :</strong>' . '<br>';
    echo $kalimat . '<br><br>';
    echo '<font color=blue> Hasil Tokenising </font>' . '<br>';
    //--------- tampilkan hasil Tokenising --------------------
    for ($i = 0; $i < $jml_kata; $i++) {
        echo 'kata ke ' . ($i + 1) . ' ==> ' . $kata[$i] . '<br>';
    }
    echo '<strong>Jumlah kata ada : ' . $i . '</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 TOKENISING</strong></p>
		<p>Masukkan kata/kalimat:</p>
示例#2
0
 $opsi_tfidf = $baris['mode_tfidf'];
 $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;
             }
         }