#!/usr/local/bin/perl -w

# fix up the english senseval 2 output

# change u and p to U and P

# change colourless to colorless

# change ~ to %

# the senseval 2 data uses wordnet sense tags, which include
# an embedded %. Unfortunately weka treats those as comments.
# So we convert the # to ~ for weka, and thereafter convert
# the ~ back to % for reporting senseval results

# this format causes weka problems
# <answer instance="art.40030" senseid="art%1:09:00::"/>

# this format causes is ok
# <answer instance="art.40030" senseid="art~1:09:00::"/>

# the senseval-2 answerkey does not include part of speech
# info on the end of words, so we remove those from our answers

while (<>)
{
	s/ u / U /g;
	s/ u\n/ U\n/g;
	s/ p / P /g;
	s/ p\n/ P\n/g;
	s/colourless/colorless/g;
	s/((\.n)|(\.v)|(\.a)) / /;    
        s /~([0-9]+):([0-9]+):([0-9]+):/%$1:$2:$3:/g;  

	print $_;
}
