示例#1
0
    def __init__(self, source, algorithm, length):
        self.bullets = None
        self.error = None
        self.highlighted_text = None

        text = parse_input(source, extractor='goose')

        if not text:
            text = parse_input(source, extractor='newspaper')

        if algorithm == 'Latent Semantic Analysis':
            summarizer = LsaSummarizer()
        elif algorithm == 'Relevance Score':
            summarizer = RelevanceSummarizer()
        elif algorithm == 'TextRank':
            summarizer = TextRankSummarizer()
        else:
            self.error = 'The summarization algorithm "{0}" does not exist'.format(algorithm)

        if not self.error:
            self.bullets = summarizer.summarize(text, length=length)

            self.highlighted_text = self.get_highlighted_text(text)

            if not self.bullets:
                self.error = "The input text is too short or could not be extracted. If you're submitting a link " \
                             "make sure that it starts with 'http://'. Otherwise, we recommend you copy and paste " \
                             "the text directly below."
def pytldr_lsa(text):
    # summarizer = LsaOzsoy()
    # summarizer = LsaSteinberger()
    summarizer = LsaSummarizer()  # This is identical to the LsaOzsoy object

    summary = summarizer.summarize(text,
                                   topics=4,
                                   length=5,
                                   binary_matrix=True,
                                   topic_sigma_threshold=0.5)
    return summary


# text = 'The contribution of cloud computing and mobile computing technologies lead to the newly emerging mobile cloud com- puting paradigm. Three major approaches have been pro- posed for mobile cloud applications: 1) extending the access to cloud services to mobile devices; 2) enabling mobile de- vices to work collaboratively as cloud resource providers; 3) augmenting the execution of mobile applications on portable devices using cloud resources. In this paper, we focus on the third approach in supporting mobile data stream applica- tions. More specifically, we study how to optimize the com- putation partitioning of a data stream application between mobile and cloud to achieve maximum speed/throughput in processing the streaming data. To the best of our knowledge, it is the first work to study the partitioning problem for mobile data stream applica- tions, where the optimization is placed on achieving high throughput of processing the streaming data rather than minimizing the makespan of executions as in other appli- cations. We first propose a framework to provide runtime support for the dynamic computation partitioning and exe- cution of the application. Different from existing works, the framework not only allows the dynamic partitioning for a single user but also supports the sharing of computation in- stances among multiple users in the cloud to achieve efficient utilization of the underlying cloud resources. Meanwhile, the framework has better scalability because it is designed on the elastic cloud fabrics. Based on the framework, we design a genetic algorithm for optimal computation parti- tion. Both numerical evaluation and real world experiment have been performed, and the results show that the par- titioned application can achieve at least two times better performance in terms of throughput than the application without partitioning.'
# pytldr_lsa(text)
示例#3
0
def pytldr_lsa():
    print ("\n","*"*30, "PYTLDR LSA", "*"*30)
    summarizer = LsaOzsoy()
    summarizer = LsaSteinberger()
    summarizer = LsaSummarizer()  # This is identical to the LsaOzsoy object

    summary = summarizer.summarize(
        text, topics=4, length=5, binary_matrix=True, topic_sigma_threshold=0.5
    )
    print (summary)
示例#4
0
from django.contrib.auth.decorators import login_required
import httplib2
from BeautifulSoup import BeautifulSoup, SoupStrainer
import re
import urllib2
from fuzzywuzzy import process
import socket
import json
from datetime import datetime, timedelta, date
from aue.models import Enquiry, EnquiryDetails
from fuzzywuzzy import fuzz
import mechanize
import operator
import numpy
from pytldr.summarize.lsa import LsaSummarizer, LsaOzsoy, LsaSteinberger
summarizer = LsaSummarizer()
import logging
logger = logging.getLogger(__name__)


def index(request):
    """
    Automated Usability Evaluation index page
    """
    #Total number of record to be display in search result
    no_record_count = [1, 2, 3, 4]
    return render(request, 'aue/index.html',
                  {"no_record_count": no_record_count})


#Here configure all html tag which you want replace from text
示例#5
0
from pytldr.summarize.lsa import LsaSummarizer, LsaOzsoy, LsaSteinberger
from pytldr.nlp import Tokenizer
import json
import numpy as np
#a = np.array([1, 2, 3])
#print(a)
with open('data/reviews_Clothing_Shoes_and_Jewelry_5_longreview.json',
          'r') as f:
    data = json.load(f)

summarizer = LsaOzsoy()
summarizer = LsaSteinberger()
summarizer = LsaSummarizer()  # This is identical to the LsaOzsoy object
txt = """
    (Reuters) - Talks between Greece and euro zone finance ministers over the country's debt crisis broke down on Monday when Athens rejected a proposal to request a six-month extension of its international bailout package as "unacceptable".
    The unexpectedly rapid collapse raised doubts about Greece's future in the single currency area after a new leftist-led government vowed to scrap the 240 billion euro ($272.4 billion) bailout, reverse austerity policies and end cooperation with EU/IMF inspectors.
    Dutch Finance Minister Jeroen Dijsselbloem, who chaired the meeting, said Athens had until Friday to request an extension, otherwise the bailout would expire at the end of the month. The Greek state and its banks would then face a looming cash crunch.
    How long Greece can keep itself afloat without foreign support is uncertain. The euro fell against the dollar after the talks broke up but with Wall Street closed for a holiday, the full force of any market reaction may only be felt on Tuesday.
    The European Central Bank will decide on Wednesday whether to maintain emergency lending to Greek banks that are bleeding deposits at an estimated rate of 2 billion euros ($2.27 billion) a week. The state faces some heavy loan repayments in March.
    Seemingly determined not to be browbeaten by a chorus of EU ministers intoning that he needed to swallow Greek pride and come back to ask for the extension, Finance Minister Yanis Varoufakis, a left-wing academic economist, voiced confidence that a deal on different terms was within reach within days.
    "I have no doubt that, within the next 48 hours Europe, is going to come together and we shall find the phrasing that is necessary so that we can submit it and move on to do the real work that is necessary," Varoufakis told a news conference, warning that the language of ultimatum never worked in Europe.
    He cited what he called a "splendid" proposal from the European Commission by which Greece would get four to six months credit in return for a freeze on its anti-austerity policies. He said he had been ready to sign that - but that Dijsselbloem had then presented a different, and "highly problematic", deal.
    A draft of what Dijsselbloem proposed, swiftly leaked by furious Greek officials, spoke of Athens extending and abiding by its "current programme" - anathema to a government which, as Varoufakis said, was elected last month to scrap the package.
    "MORE LOGIC, LESS IDEOLOGY"
    Commission officials denied offering a separate plan and the man Varoufakis said presented it, Economics Commissioner Pierre Moscovici, stuck to the same script as Dijsselbloem.
    Greece must extend its bailout on the current conditions, he said, even if that could be couched in language that did not embarrass Prime Minister Alexis Tsipras before his supporters.
    "We need more logic and less ideology," Moscovici said as EU officials fretted about how seriously the novice Greek leaders were taking their finances and how far concerns about semantics and saving political face might trump pressing economic needs.
    Dijsselbloem, who insisted he was willing to be flexible on terminology that has become highly charged for Greek voters, said further talks would depend on Greece requesting a bailout. Varoufakis and the other ministers will remain in Brussels on Tuesday for a routine meeting on the EU economy.
    "The general feeling in the Eurogroup is still that the best way forward would be for the Greek authorities to seek an extension of the programme," Dijsselbloem told a news briefing.
    Echoing that, Moscovici insisted there was no "Plan B", a phrase bounced back in his turn by Varoufakis, who invoked the language of high stakes poker: "It's not a bluff," he said.
    "It's Plan A. There is no Plan B."