code: def pat(p):
      
      pattern = []
      for matrix in [m.group(0) for m in MT_REGEX.finditer(p)]:
          segment = set([m.groups() for m in FT_REGEX.finditer(matrix)])
          pattern.append(segment)
      return pattern
docs: Given a string `p` with feature matrices (features grouped with square
      brackets into segments, return a list of sets of (value, feature) tuples.
  
      Args:
          p (str): list of feature matrices as strings
  
      Return:
          list: list of sets of (value, feature) tuples