-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreprocess.php
More file actions
59 lines (30 loc) · 866 Bytes
/
preprocess.php
File metadata and controls
59 lines (30 loc) · 866 Bytes
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
<?php
//cluster the jargon, key words, class and sub class, relations between keywords
$sample = "Some text here
";
//TO-DO: UTF-8 Text
parseTextAndReturnBOW($sample);
function parseTextAndReturnBOW($text){
$markers = array(' ',',',';','.');
$rawDataArray = explode(' ',$text);
$cleanDataArray = cleanIteratively($rawDataArray);
//echo "<pre>";
print_r($cleanDataArray);
}
function cleanIteratively($dataArray){
$markers = array(" ",",",";",".","\n\r","\n","\r"); // <--- exhaustive list of funny characters
foreach($dataArray as $ind => $txt){
$dataArray[$ind] = str_replace($markers,'',trim($txt)); // <--- replace with preg_replace
}
foreach($dataArray as $key => $link)
{
if($link === '')
{
unset($dataArray[$key]);
}
}
return $dataArray;
}
function cleanRecursively(){
}
?>