-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path3-test.php
49 lines (37 loc) · 1.31 KB
/
3-test.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
namespace MachineLearning;
use MachineLearning\Util\Input;
include 'Util/Input.php';
$ann = fann_create_from_file('Data/training_result');
if (!$ann) {
die("ANN could not be created");
}
$input = new Input();
$comments[] = '//simple comment';
$comments[] = '/**
* Returns the same version for all assets.
*
* @author Fabien Potencier <[email protected]>
*/';
$comments[] = '// $this->getAll(3);';
$comments[] = '//fix for v1.2';
$comments[] = '/* if ($path && \'/\' == $path[0]) {
return \'/\'.$versionized;
}*/';
$comments[] = '// We have server(s) -> apply default configuration';
$comments[] = '/* The <info>%command.name%</info> command clears the application cache for a given environment
and debug mode:
<info>php %command.full_name% --env=dev</info>
<info>php %command.full_name% --env=prod --no-debug</info>*/';
$comments[] = '// avoid shutting down the Kernel if no request has been performed yet
// WebTestCase::createClient() boots the Kernel but do not handle a request';
foreach ($comments as $comment) {
$result = fann_run($ann, $input->getInputFromComment($comment));
printf("COMMENT : %s\n", $comment);
printf("RESULT : %f\n", $result[0]);
if ($result[0] > 0.9) {
echo ("!!! CODE DETECTED !!!\n");
}
echo ("\n");
}
fann_destroy($ann);