docs: def convert_to_cg3_input( mrf_lines ):
      ''' Converts given mrf lines from syntax preprocessing format to cg3 input
          format:
            *) surrounds words/tokens with "< and >"
            *) surrounds word lemmas with " in analysis;
            *) separates word endings from lemmas in analysis, and adds prefix 'L';
            *) removes '//' and '//' from analysis;
            *) converts hashtags to tags surrounded by < and >;
            ... and provides other various fix-ups;
  
          Returns the input list, where elements (tokens/analyses) have been converted
          into the new format;
      ''' 
      i = 0
      while ( i < len(mrf_lines) ):
          line = mrf_lines[i]
          if not line.startswith('  ') and len(line) > 0:
             #
             # A line containing word/token
             #
             #  a. surround the word with "< and >"
             line = re.sub('^(\S.*)([\n\r]*)$','"<\\1>"\\2', line)
             #  b. fix the sentence begin/end tags
             line = re.sub('<<(s|/s)>>', '<\\1>', line)
             mrf_lines[i] = line
          elif line.startswith('  '):
             #
             # A line containing analysis
             #
             #  1. perform various fixes:
             line = re.sub('#cap #cap','cap', line)
             line = re.sub('#cap','cap', line)
             line = re.sub('\*\*CLB','CLB', line)
             line = re.sub('#Correct!','<Correct!>', line)
             line = re.sub('####','', line)
             line = re.sub('#(\S+)','<\\1>', line)
             line = re.sub('\$([,.;!?:<]+)','\\1', line)
             line = re.sub('_Y_\s+\? _Z_','_Z_', line)
             line = re.sub('_Y_\s+\?\s+_Z_','_Z_', line)
             line = re.sub('_Y_\s+_Z_','_Z_', line)
             line = re.sub('_Z_\s+\?','_Z_', line)
             #  2. convert analysis line \w word ending
             line = re.sub('^\s+(\S+)(.*)\+(\S+)\s*//_(\S)_ (.*)//(.*)$', \
                           '    "\\1\\2" L\\3 \\4 \\5 \\6', line)
             #  3. convert analysis line \wo word ending
             line = re.sub('^\s+(\S+)(.*)\s+//_(\S)_ (.*)//(.*)$', \
                           '    "\\1\\2" \\3 \\4 \\5', line)
             mrf_lines[i] = line
          i += 1
      return mrf_lines