-
Notifications
You must be signed in to change notification settings - Fork 4
/
Porter_stemming.php
112 lines (100 loc) · 2.59 KB
/
Porter_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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
$starttime = microtime(true);
include 'fungsi.php';
set_time_limit(0);
?>
<!DOCTYPE html>
<html>
<head>
<title>Aplikasi Porter Stemming Bahasa Indonesia</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="header">
<h1><a href="">Aplikasi Porter Stemming Bahasa Indonesia</a></h1>
</div>
<div id="content">
<?php
if(!isset($_POST["submit"])) {
?>
<div class="col-6 form">
<div id="form">
<h2>Masukkan Kata</h2>
<form action="" method="POST">
<input type="text" name="kata" placeholder="Kata">
<input type="submit" name="submit" value="kirim">
</form>
</div>
</div>
<?php
} else {
$contents = new NLP;
$plain_text = $_POST['kata'];
$content = $contents->tokenisasi($plain_text); // $content = kata yg sudah ditokenisasi, misahkan kata2
$wordcount = count($content);
$statsplain = $contents->tf_plain($content); //TF
$statsstop = $contents->tf_stopword($content); //TF
$statsstem = $contents->tf_stemming($content); //TF
?>
<div class="col-6 form">
<div id="form">
<h2>Masukkan Kata</h2>
<form action="" method="POST">
<input type="text" name="kata" placeholder="Kata">
<input type="submit" name="submit" value="kirim">
</form>
</div>
</div>
<div class="col-6 form">
<div id="table">
<div class="header">
<h2>Term Frequency</h2>
<div class="tab-button">
<div id="tab3" class="col-4" style="width: 100%" onclick="showpage3()"><a href="javascript:void(0)">Stemming</a></div>
<div style="clear:both"></div>
</div>
</div>
<div class="tab-content">
<div id="page3" style="display: block;">
<div class="scroll">
<table>
<tr>
<th>Peringkat</th>
<th>Kata</th>
<th>Frekuensi</th>
</tr>
<?php
$i=1;
foreach ($statsstem as $term => $count) {
if($term != ""){
?>
<tr>
<td><?php echo $i ?></td>
<td><?php echo $term ?></td>
<td><?php echo $count ?></td>
</tr>
<?php
$i++;
}
}
?>
</table>
</div>
</div>
</div>
</div>
</div>
<div style="clear: both;"></div>
<?php } ?>
</div><!-- END CONTENT -->
<footer>
I Putu Iduar Perdana - I Wayan Gunaya - Putu Jhonarendra<br /><br />
<?php
$endtime = microtime(true);
echo "Load time: ";
echo $endtime-$starttime."s";
?>
</footer>
</body>
</html>