docs: def tag_subcat_info( mrf_lines, subcat_rules ):
      ''' Adds subcategorization information (hashtags) to verbs and adpositions;
          
          Argument subcat_rules must be a dict containing subcategorization information,
          loaded via method load_subcat_info();
  
          Performs word lemma lookups in subcat_rules, and in case of a match, checks 
          word part-of-speech conditions. If the POS conditions match, adds subcategorization
          information either to a single analysis line, or to multiple analysis lines 
          (depending on the exact conditions in the rule);
  
          Returns the input list where verb/adposition analyses have been augmented 
          with available subcategorization information;
      ''' 
      i = 0
      while ( i < len(mrf_lines) ):
          line = mrf_lines[i]
          if line.startswith('  '):
             lemma_match = analysisLemmaPat.match(line)
             if lemma_match:
                lemma = lemma_match.group(1)
                # Find whether there is subcategorization info associated 
                # with the lemma
                if lemma in subcat_rules:
                   analysis_match = analysisPat.search(line)
                   if not analysis_match:
                      raise Exception(' Could not find analysis from the line:',line)
                   analysis = analysis_match.group(1)
                   for rule in subcat_rules[lemma]:
                       condition, addition = rule.split('>')
                       # Check the condition string; If there are multiple conditions, 
                       # all must be satisfied for the rule to fire
                       condition  = condition.strip()
                       conditions = condition.split()
                       satisfied1 = [ _check_condition(c, analysis) for c in conditions ]
                       if all( satisfied1 ):
                          #
                          # There can be multiple additions:
                          #   1) additions without '|' must be added to a single analysis line;
                          #   2) additions separated by '|' must be placed on separate analysis 
                          #      lines;
                          #
                          additions = addition.split('|')
                          j = i
                          # Add new line or lines
                          for a in additions:
                              line_copy = line if i == j else line[:] 
                              items_to_add = a.split()
                              for item in items_to_add:
                                  if not _check_condition(item, analysis):
                                     line_copy = \
                                         re.sub('(//.+\S)\s+//', '\\1 '+item+' //', line_copy)
                              if j == i:
                                 # 1) replace the existing line
                                 mrf_lines[i] = line_copy
                              else:
                                 # 2) add a new line 
                                 mrf_lines.insert(i, line_copy)
                              j += 1
                          i = j - 1
                          # No need to search forward
                          break
          i += 1
      return mrf_lines