-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlearner_test.rb
51 lines (37 loc) · 1.03 KB
/
learner_test.rb
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
require "./learner.rb"
type = :default;
case ARGV[0]
when "C99"
type = :C99;
when "java"
type = :java;
end
s = [];
#s.push("@@types_inheritance[:punctuation] = :spchar;");
#s.push("@@types_inheritance[:float ] = :int;");
learner = Learner.new(type)
#learner.generate_learning_data(s)
s2 = []
############################
# Insert training data here.
############################
s2.push "class.method = {1, 2, 4, 5};"
s2.push "int y_from;"
s2.push "extern void noize_delete(struct Pixel **matrix, int x, int y);"
s2.push "loadMatrix(\"matrix.ppm\", &matrix, &x, &y);"
s2.push "m2.y_from = y / 2 + 1;"
s2.push "if(0 == matrix[i][j].B)"
s2.push "matrix->matrix[i][j].B = 255;"
s2.push "if(i != matrix->y_from)"
s2.push "*ymass = Ysum / TotalMass;"
s2.push "Ysum += j;"
s2.push "FILE *f = fopen(fname, \"r\");"
s2.push "case State.QLD:city = \"Brisbane\"; break;"
s2.push "matrix[i][j - 1],"
############################
#
############################
s2.each do |str|
learner.extract_min_space_data(str);
end
learner.generalize();