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
|
#!/opt/local/bin/gawk -f
# Usage: com_mark.awk [file]
#
# Copyright 1998 Stephan Schulz, schulz@informatik.tu-muenchen.de
#
#
BEGIN{
pos = 0;
neg = 0;
toggle=0;
count2=0;
count1=0;
}
function classify_term()
{
return $9=="s";
}
/^#/{
next;
}
/[A-Za-z0-9]+/{
if(classify_term())
{
pos++;
print $1 " : 1:(1, 1).";
}
else
{
if(toggle)
{
pos++;
print "f2" count2 "(f1" count1 "(" $1 ")," $1, ") : 1:(1, 1).";
count1++;
if(count1 == 2)
{
count1 = 0;
}
count2++;
if(count2 == 3)
{
count2 = 0;
}
}
else
{
neg++;
print $1 " : 1:(1,-1).";
}
}
toggle = !toggle;
}
END{
print "# Pos: " pos " Neg: " neg;
}
|