# call program as so: # cat tagger_output.tts | perl convert.pl > YOURFILE_pos_level.xml # Before calling the program, it might be a good idea to first do the # following: # mv YOURFILE_pos_level.xml backup.xml # Do not add extra newlines - apparently, this messes MMAX2 up (?) $header = ''."\n".''."\n".''."\n"; sub make_line { $sid=$_[0]; $pos_tag=$_[1]; $line = ''; $line = ') { chomp; # ignore lines starting with '%%', i.e., comment lines from TnT if (!/^%%/) { # split the line, in order to get the POS tag @my_list = split(/\s+/,$_); # ignore the word & grab just the POS tag (fyi: this assumes that # each word has no spaces in it) $pos_tag = $my_list[1]; # make the appropriate XML line & print it out print &make_line($index,$pos_tag); # iterate the index properly $index++; } } # If MMAX2 gives weird behavior, it may help to try with/without a # trailing newline here (?) print "";