(self, number, normalize=True)
return [(t, weight) for weight, t in tlist[:number]]
Returns the N most important terms in the vectors added so far.

        :param number: The number of terms to return.
        :param normalize: Whether to normalize the weights.
        :returns: A list of ("term", weight) tuples.
Returns the N most important terms in the vectors added so far.
Returns the N most important terms in the vectors added so far .
def expanded_terms(self, number, normalize=True):
        """Returns the N most important terms in the vectors added so far.

        :param number: The number of terms to return.
        :param normalize: Whether to normalize the weights.
        :returns: A list of ("term", weight) tuples.
        """

        model = self.model
        fieldname = self.fieldname
        ixreader = self.ixreader
        field = ixreader.schema[fieldname]
        tlist = []
        maxweight = 0

        # If no terms have been added, return an empty list
        if not self.topN_weight:
            return []

        for word, weight in iteritems(self.topN_weight):
            btext = field.to_bytes(word)
            if (fieldname, btext) in ixreader:
                cf = ixreader.frequency(fieldname, btext)
                score = model.score(weight, cf, self.top_total)
                if score > maxweight:
                    maxweight = score
                tlist.append((score, word))

        if normalize:
            norm = model.normalizer(maxweight, self.top_total)
        else:
            norm = maxweight
        tlist = [(weight / norm, t) for weight, t in tlist]
        tlist.sort(key=lambda x: (0 - x[0], x[1]))

        return [(t, weight) for weight, t in tlist[:number]]
def expanded_terms ( self , number , normalize = True ) : model = self . model fieldname = self . fieldname ixreader = self . ixreader field = ixreader . schema [ fieldname ] tlist = [ ] maxweight = 0 # If no terms have been added, return an empty list if not self . topN_weight : return [ ] for word , weight in iteritems ( self . topN_weight ) : btext = field . to_bytes ( word ) if ( fieldname , btext ) in ixreader : cf = ixreader . frequency ( fieldname , btext ) score = model . score ( weight , cf , self . top_total ) if score > maxweight : maxweight = score tlist . append ( ( score , word ) ) if normalize : norm = model . normalizer ( maxweight , self . top_total ) else : norm = maxweight tlist = [ ( weight / norm , t ) for weight , t in tlist ] tlist . sort ( key = lambda x : ( 0 - x [ 0 ] , x [ 1 ] ) ) return [ ( t , weight ) for weight , t in tlist [ : number ] ]