01.
$str_Ngram
=
explode
(
"|"
,
$str_segmented
);
02.
03.
for
(
$j
=0;
$j
<
count
(
$str_Ngram
);
$j
++)
04.
{
05.
06.
$sql
=
"SELECT * from onegram where w_one ='$str_Ngram[$j]'"
;
07.
08.
09.
$result
= mysql_query(
$sql
)
or
die
(mysql_error());
10.
echo
"Index"
.
$j
.
$str_Ngram
[
$j
].
"<br>"
.
"ความถี่เท่ากับ"
.
"<br>"
;
11.
while
(
$row
= mysql_fetch_assoc (
$result
))
12.
{
13.
$w_one
=
$row
[
"w_one"
];
14.
$frequency
=
$row
[
"frequency"
];
15.
16.
echo
$row
[
"frequency"
].
"<br>"
;
17.
$open
=
fopen
(
"wordNgram.txt"
,
'a'
);
18.
fwrite(
$open
,
$row
[
"w_one"
]);
19.
fclose(
$open
);
20.
}
21.
mysql_free_result(
$result
);
22.
23.
}
24.
}