def tuple( props ): """ search the words that have the specific properties """ Find = lambda source, dist, itm: [dist[i] for i in [i for i in range( len( source ) ) if source[i] == itm]] wset = set() firsttime = True for propkey in props.keys(): if worddict.has_key( propkey ): partial_wset = set( Find( worddict[propkey], worddict["word_"], props[propkey] ) ) if firsttime: wset = partial_wset;firsttime = False else: wset &= partial_wset else: #property has now index pass return list( wset )
def tuple( props ): """ search the words that have the specific properties """ wset = set() firsttime = True for propkey in props.keys(): if worddict.has_key( propkey ): partial_wset = set( FIND( worddict[propkey], worddict["word_"], props[propkey] ) ) if firsttime: wset = partial_wset;firsttime = False else: wset &= partial_wset else: # property has now index pass return list( wset )
def tuple(props): """ search the words that have the specific properties """ wset = set() firsttime = True for propkey in props.keys(): if worddict.has_key(propkey): partial_wset = set( FIND(worddict[propkey], worddict["word_"], props[propkey])) if firsttime: wset = partial_wset firsttime = False else: wset &= partial_wset else: # property has now index pass return list(wset)
def tuple(props): """ search the words that have the specific properties """ Find = lambda source, dist, itm: [ dist[i] for i in [i for i in range(len(source)) if source[i] == itm] ] wset = set() firsttime = True for propkey in props.keys(): if worddict.has_key(propkey): partial_wset = set( Find(worddict[propkey], worddict["word_"], props[propkey])) if firsttime: wset = partial_wset firsttime = False else: wset &= partial_wset else: #property has now index pass return list(wset)