28 lines
936 B
Python
28 lines
936 B
Python
# coding:utf-8
|
||
from pattern.fr import parse, split
|
||
|
||
texte = parse(u"Le petit chat attend que l'esclave humain daigne lui apporter son repas.")
|
||
|
||
|
||
def imprimer_structure_mot ( mot ):
|
||
'''imprime la structure de la phrase'''
|
||
print 'index : ' + str( phrase.index )
|
||
print 'string : ' + str( phrase.string )
|
||
print '_custom_tags : ' + str( phrase._custom_tags )
|
||
print 'sentence : ' + str( phrase.sentence )
|
||
print 'pnp : ' + str( phrase.pnp )
|
||
print 'chunk : ' + str( phrase.chunk )
|
||
print 'lemma : ' + str( phrase.lemma )
|
||
print 'type : ' + str( phrase.type )
|
||
|
||
for phrase in split( texte ):
|
||
# print phrase.__dict__.keys()
|
||
# print "---"
|
||
# print phrase.chunks[0].__dict__.keys()
|
||
# print phrase.pnp.__dict__.keys()
|
||
for mot in phrase.words:
|
||
print mot.__dict__.keys()
|
||
print "---"
|
||
#imprimer_structure_mot( mot )
|
||
# imprimer_la_structure_de_la_phrase( phrase.words[0] )
|