-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgyaani.pl~
121 lines (116 loc) · 2.1 KB
/
gyaani.pl~
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
113
114
115
116
117
118
119
120
121
use 5.010;
use strict;
use warnings;
my %d=(clique=>1,size=>2,length=>3,shortest=>4,list=>5,people=>6,graph=>7,importance=>8,important=>8,more=>9);
print "Type \"exit\" to get out of here\n";
while(1){
print "Enter Query\n";
my $he=<STDIN>;
chomp $he;
$he =~ s/\?/ /ig;
my @q=split(' ',$he,length($he));
my $arr='';
my $elm;
if ($he eq 'exit'){
last;
}
for my $mm (@q)
{
$elm=$d{$mm};
if (defined $elm){
$arr.=$elm;
}
}
my $quer=0;
my $entry1='nulli';
my $entry2='nulli';
if (defined $arr){
#Query 1
if ($arr=='12' || $arr=='21'){
#Take out the entry number
$quer=1;
for my $mf (@q){
if ($mf=~ /[12][0-9][0-9][0-9]/){
$entry1=$mf;
}
}
}
#Query 2
if ($arr=='43' || $arr=='34'){
#Take out the entry number
$quer=2;
my $fff=1;
for my $mf (@q){
if ($mf=~ /[12][0-9][0-9][0-9]/){
if ($fff){
$entry1=$mf;
$fff=0;
}
else{
$entry2=$mf;
}
}
}
}
#Query 3
if ($arr=='54' || $arr=='45'){
#Take out the entry number
$quer=3;
my $fff=1;
for my $mf (@q){
if ($mf=~ /[12][0-9][0-9][0-9]/){
if ($fff){
$entry1=$mf;
$fff=0;
}
else{
$entry2=$mf;
}
}
}
}
#Query 4
if ($arr=='47' || $arr=='74' ||$arr=='4'){
$quer=4;
}
#Query 5
if ($arr=='8'){
$quer=5;
for my $mf (@q){
if ($mf=~ /[12][0-9][0-9][0-9]/){
$entry1=$mf;
}
}
}
#Query 6
if ($arr=='89'||$arr=='98'){
$quer=6;
for my $mf (@q){
if ($mf=~ /[12][0-9][0-9][0-9]/){
$entry1=$mf;
}
}
}
print "Query:".$quer."\n";
}
else{
print "No Query Match\n";
}
my @args=("./analyzer ",$quer." ",$entry1." ",$entry2);
print @args;
system(@args)==0
or die "system failed";
print "Do you want to continue?\n";
$he=<STDIN>;
chomp $he;
if ($he eq "no" || $he eq "No" || $he eq "NO"){
print "Exiting....";
last;
}
elsif ($he eq "yes" || $he eq "Yes" || $he eq "YES"){
}
else{
print "Invalid Choice...Exiting....";
last;
}
}