docs: def parse_cgn_postag(rawtag, raisefeatureexceptions = False):
      global subsets, constraints
      """decodes PoS features like "N(soort,ev,basis,onz,stan)" into a PosAnnotation data structure 
      based on CGN tag overview compiled by Matje van de Camp"""
      
      
      begin = rawtag.find('(')
      if rawtag[-1] == ')' and begin > 0:
          tag = folia.PosAnnotation(None, cls=rawtag,set='http://ilk.uvt.nl/folia/sets/cgn')
  
          
          head = rawtag[0:begin]
          tag.append( folia.Feature, subset='head',cls=head)
  
          rawfeatures = rawtag[begin+1:-1].split(',')
          for rawfeature in rawfeatures:            
              if rawfeature:
                  found = False
                  for subset, classes in subsets.items():
                      if rawfeature in classes:
                          if subset in constraints:
                              if not head in constraints[subset]:
                                  continue #constraint not met!
                          found = True
                          tag.append( folia.Feature, subset=subset,cls=rawfeature)
                          break
                  if not found:
                      print("\t\tUnknown feature value: " + rawfeature + " in " + rawtag, file=stderr)
                      if raisefeatureexceptions:
                          raise InvalidFeatureException("Unknown feature value: " + rawfeature + " in " + rawtag)
                      else:    
                          continue
          return tag
      else:
          raise InvalidTagException("Not a valid CGN tag")