commited all contents created by participants
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
# coding:utf-8
|
||||
from pattern.fr import parsetree, parse, split
|
||||
|
||||
texte = parse(u"Le petit chat attend que l'esclave humain daigne lui apporter son repas.")
|
||||
|
||||
|
||||
def imprimer_la_structure_de_la_phrase ( phrase ):
|
||||
'''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 )
|
||||
|
||||
|
||||
#print texte
|
||||
|
||||
|
||||
for phrase in split( texte ):
|
||||
print phrase.__dict__.keys()
|
||||
print "---"
|
||||
print phrase.chunks[0].__dict__.keys()
|
||||
# print phrase.pnp.__dict__.keys()
|
||||
#imprimer_la_structure_de_la_phrase( phrase.words[0] )
|
||||
|
||||
'''
|
||||
print "---"
|
||||
print "contenu :"
|
||||
print split( texte ).words[0].__dict__.keys()
|
||||
print ""
|
||||
print 'index : ' + str( split( texte ).words[0].index )
|
||||
print 'string : ' + str( split( texte ).words[0].string )
|
||||
print '_custom_tags : ' + str( split( texte ).words[0]._custom_tags )
|
||||
print 'sentence : ' + str( split( texte ).words[0].sentence )
|
||||
print 'pnp : ' + str( split( texte ).words[0].pnp )
|
||||
print 'chunk : ' + str( split( texte ).words[0].chunk )
|
||||
print 'lemma : ' + str( split( texte ).words[0].lemma )
|
||||
print 'type : ' + str( split( texte ).words[0].type )
|
||||
'''
|
||||
#print split( texte ).words[0].type
|
||||
# 'index', 'string', '_custom_tags', 'sentence', 'pnp', 'chunk', 'lemma', 'type'
|
||||
|
||||
'''
|
||||
for lexeme in lexemes:
|
||||
for chunk in lexeme.chunks:
|
||||
print chunk.type, [(w.string, w.type) for w in chunk.words]
|
||||
'''
|
||||
Reference in New Issue
Block a user