forked from synalp/NER
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-good-format.awk
More file actions
33 lines (33 loc) · 814 Bytes
/
Copy pathmake-good-format.awk
File metadata and controls
33 lines (33 loc) · 814 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
BEGIN {
label = "NO";
flag = "noend";
}
{
for (i=1;i<=NF;i++)
if ($i != "<p>" && $i != "</p>" && $i != "<td>" && $i != "</td>" && $i != "<tr>" && $i != "</tr>" && $i != "<table>" && $i != "</table>") {
if ($i == "." || $i == "?" || $i == "!") {
printf ("%s\tNO\n\n",$i);
}
else {
str = $i;
if (substr(str,1,1) == "<") { #NE begin
if (index(str,ne) > 0) { #the requested NE begin
label = ne "B";
flag = "noend";
}
sub(/<[a-zA-Z0-9_-]+>/,"",str);
#print "str="str;
}
if (substr(str,length(str),1) == ">") { #NE end
sub(/<\/[a-zA-Z0-9_-]+>/,"",str);
flag = "end";
}
print str "\t" label;
if (index(label,ne) > 0 && flag == "noend") { #modify label from NEB -> NEI
label = ne "I";
} else {
label = "NO";
}
}
}
}