def parse_sents(inputs, grammar, trace=0):
 from nltk.grammar import FeatureGrammar
 from nltk.parse import FeatureChartParser, load_parser
 if isinstance(grammar, FeatureGrammar):
  cp = FeatureChartParser(grammar)
 else:
  cp = load_parser(grammar, trace=trace)
 parses = []
 for sent in inputs:
  tokens = sent.split()
  syntrees = list(cp.parse(tokens))
  parses.append(syntrees)
 return parses

def parse_sents ( inputs , grammar , trace = 0 ) : from nltk . grammar import FeatureGrammar from nltk . parse import FeatureChartParser , load_parser if isinstance ( grammar , FeatureGrammar ) : cp = FeatureChartParser ( grammar ) else : cp = load_parser ( grammar , trace = trace ) parses = [ ] for sent in inputs : tokens = sent . split ( ) syntrees = list ( cp . parse ( tokens ) ) parses . append ( syntrees ) return parses
convert input sentences into syntactic trees .