Example #1
0
def get_summary(cleaned_articles):
    # get article summaries
    summary = [indicoio.summarization(item) for item in cleaned_articles]
    # clean up result for easy readability
    print "Here are the summaries for all %d articles:" % (len(summary))
    for line in summary:
        print "\n" + " ".join(line)
Example #2
0
    def POST(self):
        data = web.input().textarea
        req = requests.get(data)
        soup = BeautifulSoup(req.text, "lxml")
        tagp = soup.find_all('p')

        final = []

        for tag in tagp:
            textf = indicoio.summarization(tag.text)
            textff = ' '.join(textf)
            final.append(textff)

        return final
Example #3
0
 def test_summarization(self):
     response = summarization(TEXT_DATA, top_n=5)
     self.assertTrue(isinstance(response, list))
     self.assertEqual(len(response), 5)
Example #4
0
def get_summary(data):
    set_api_key()
    if data:
        return indicoio.summarization(data)
Example #5
0
def summarizer(resume):
    return indicoio.summarization(resume)
Example #6
0
    def GET(self):
        user_data = web.input(id='https://wiki.metakgp.org/w/Code.Fun.Do')
        #data_new = web.input(name = 'none')
        x = user_data.id
        #yg = data_new.name
        #x = 'https://en.wikipedia.org/wiki/Python_(programming_language)'
        req = requests.get(x)
        soup = BeautifulSoup(req.text, "lxml")

        tagh1 = soup.find_all('h1')

        tagh2 = soup.find_all('h2')

        yes = []

        count = 0

        for h1s in tagh1:

            if (h1s.name == 'h1'):

                yes.append(h1s.text)

        for h2s in tagh2:

            middata = []

            if (h2s.text == 'See also' or h2s.text == 'References'
                    or h2s.text == 'See also[edit]'
                    or h2s.text == 'References[edit]'):

                break

            if (h2s.text != 'Contents'):

                yes.append(h2s.text)

                for midpara in h2s.nextSiblingGenerator():

                    if (midpara.name == 'h2'):

                        break

                    middata.append(midpara)

                    pdata = []

                for somedata in middata:

                    if (somedata.name == 'h3'):

                        #newtext = ' '.join(pdata)
                        #ftext = indicoio.summarization(newtext.text)
                        #yes.append(ftext)
                        ndata = ' '.join(pdata)
                        yes.append(ndata)

                        pdata = []

                        yes.append(somedata.text)

                        count = 1

                    if (somedata.name == 'p'):

                        pdata.append(somedata.text)

                        ftext = '.'.join(pdata)

                        newdata = indicoio.summarization(ftext)
                        pdata = newdata

                        #pdata = indicoio.summarization(pdata)
                        #textnew = ' '.join(summnew)
                        #pdata = textnew
                        #pdata = '.'.join(pdata)

                if (count == 0):

                    #newtext = ' '.join(pdata)
                    #ftext = indicoio.summarization(newtext.text)
                    mdata = ' '.join(pdata)
                    yes.append(mdata)

        y = soup.find_all('p')
        o = y[0].text

        z = []

        #for i in range(0, len(yes)):
        #	z.append(indicoio.summarization(yes[i]))
        #finaltext = ' '
        #finaltext = ' '.join(yes);
        #summtext = indicoio.summarization(finaltext)
        # text = ''

        # for i in range(0, len(z)):
        # 	text = text + z[i] + '\n'

        return self.render.index(yes)
Example #7
0
 def POST(self):
     data = web.input().textarea
     textf = indicoio.summarization(data)
     text = ' '.join(textf)
     return text
Example #8
0
 def __init__(self, text):
     self.article = text
     self.summary = TextBlob(''.join(indicoio.summarization(self.article)))