Esempio n. 1
0
    def __init__(self,
                 name,
                 is_lazy,
                 lazy_directory,
                 debug,
                 strategy,
                 scoring_function,
                 ordering_criteria=ORDERING_CRITERIA.POSITION):
        """
    Constructor of the component.

    @param  name:               The name of the component.
    @type   name:               C{string}
    @param  is_lazy:            True if the component must load previous data,
                                False if data must be computed tought they have
                                already been computed.
    @type   is_lazy:            C{bool}
    @param  lazy_directory:     The directory used to store previously computed
                                data.
    @type   lazy_directory:     C{string}
    @param  debug:              True if the component is in debug mode, else
                                False. When the component is in debug mode, it
                                will output each step of its processing.
    @type   debug:              C{bool}
    @param  strategy:           The strategy used to specialized the graph
                                construction and usage.
    @type   strategy:           C{TextRankStrategy}
    @param  scoring_function:   Function used to compute the scores of the
                                textual units, when the give candidates to
                                weight are not single words.
    @type   scoring_function:   C{function(expression, word_weights): float}
    @param  ordering_criteria:  The criteria to use to order the cluster.
                                - Position: the first appearing candidate, in
                                the document, is ranked first.
                                - Frequency: the most frequent candidate, in the
                                document, is ranked first.
                                - Centroid: The centroid of the cluster is
                                ranked first.
    @type   ordering_criteria: C{ORDERING_CRITERIA}
    TODO TODO
    TODO TODO
    TODO TODO
    TODO TODO
    """

        super(TextRankRanker, self).__init__(name, is_lazy, lazy_directory,
                                             debug)

        self._strategy = strategy
        self._textrank = TextRank(strategy, scoring_function, 0.0001, 0.85,
                                  1000000)
        self._ordering_criteria = ordering_criteria