un-premier-essai-avec-pattern~20171216-125906.py 332 B

1234567891011121314
  1. from pattern.fr import parse, split
  2. lexemes = parse(u"Le petit chat attend que l'esclave humain daigne lui apporter son repas..")
  3. print lexemes
  4. '''
  5. for sentence in split( lexemes ):
  6. print sentence
  7. '''
  8. for lexeme in lexemes:
  9. for chunk in lexeme.chunks:
  10. print chunk.type, [(w.string, w.type) for w in chunk.words]