#NEWLINE# def get_all_leafs( synset_name ) : #NEWLINE# #INDENT# hitem = hierarchy . get ( synset_name , None ) #NEWLINE# if ( hitem is None ) : #NEWLINE# #INDENT# raise Exception ( 'synset is not in hierarchy' ) #NEWLINE# #UNINDENT# if hitem [ 'children' ] : #NEWLINE# #INDENT# leafs = [ ] #NEWLINE# for csynset in hitem [ 'children' ] : #NEWLINE# #INDENT# leafs = ( hitem + get_all_leafs ( csynset ) ) #NEWLINE# #UNINDENT# leafs = list ( np . unique ( leafs ) ) #NEWLINE# return leafs #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return [ synset_name ]