Giter Site home page Giter Site logo

Comments (2)

aond avatar aond commented on August 16, 2024

`
def summarize(self, text, n):
text = text.replace('\n', '')
text = text.replace('\r', '')
text = utils.as_text(text)
tokens = utils.cut_sentences(text)
sentences, sents = utils.cut_filter_words(tokens, self.__stop_words, self.__use_stopword)

    graph = self.create_graph(sents)
    scores = utils.weight_map_rank(graph, self.__max_iter, self.__tol)
    sent_selected = nlargest(n, zip(scores, count()))
    sent_index = []
    for i in range(n):
    # 可能这样更好
    # for i in range(min(len(sent_selected), n))
        sent_index.append(sent_selected[i][1])
    return [sentences[i] for i in sent_index]`

from jiagu.

ownthink avatar ownthink commented on August 16, 2024

@aond 多谢,已经修复。

from jiagu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.