This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
full_stemming.php
49 lines (41 loc) · 1.78 KB
/
full_stemming.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
date_default_timezone_set('Asia/Jakarta');
include "connection.php";
include "text_preprocessing/stemming_code/stemming_indonesia.php";
include "text_preprocessing/stemming_code/stemming_english_2.php";
//====================================================================
// Function untuk melakukan stemming filtered words buku dari database
//====================================================================
function doStemming($docs,$conn){
if($docs->num_rows > 0){
while($array_filter = $docs->fetch_assoc())
{
$save_stemming = '';
$biblio_id = $array_filter['biblio_id'];
$filtering = trim($array_filter['filtering']);
$language_desc = $array_filter['language_desc'];
$filtering = explode(" ",$filtering);
foreach($filtering as $filter_word){
if($language_desc == 'id'){
$stemming = stemming_indonesia($filter_word);
}else{
$stemming = stemming_english($filter_word);
}
$save_stemming .= $stemming.' ';
}
$query_update = "UPDATE buku_research_uji SET stemming='$save_stemming'
WHERE biblio_id LIKE '$biblio_id' ";
$update = $conn->query($query_update);
if($update){
echo "</br>stemming biblio_id $biblio_id BERHASIL";
}else{
echo "</br>stemming biblio_id $biblio_id GAGAL";
}
}
}
}
// Stemming Description
$query_desc = "SELECT biblio_id, filtering,language_desc FROM buku_research_uji WHERE stemming LIKE '' ";
$docs = $conn->query($query_desc);
doStemming($docs,$conn);
?>