code: def extract_finditer(pos_seq, regex=SimpleNP):
      """The "GreedyFSA" method in Handler et al. 2016.
      Returns token position spans of valid ngrams."""
      ss = coarse_tag_str(pos_seq)
  
      def gen():
          for m in re.finditer(regex, ss):
              yield (m.start(), m.end())
  
      return list(gen())
  
imports: from __future__ import print_function
  import os
  import re
  import sys
  from collections import Counter
label_desc: Use image node_id 3 for calling a global function with example usage: extract_finditer(pos_seq, regex) and returns: list