#!/usr/bin/perl
use warnings;
use utf8;
$|=1;

while (<>) {
    if (/^</) {print "\n$_"; goto loopend;}
    s/^("<)\*([^>])/$1\u$2/;
    s/^("<.*?>").*$/$1/; # strip wordform line
    s/(.)\n/$1 /; # space added because of ADV/CONJ colouring in ambiguous readings
    if (s/^\"</\n/g) {
      s/>\"//g;
    }
    s/^[ \t]+\"/\t \[/g;
    s/\t\"/\t\[/g; # after line.vislcg
    s/(.[^ \t])\" /$1\] /g;

    s/ +\{[^\}\n]*\} +/ /g;
    s/ *\{[^\}\n]*\} *//g;
    s/ [0-9]+\n/\n/g;
    s/<(\$|\/|hi)>/\n<$1>/g;
    print;
loopend:
}


