Exemplo n.º 1
0
def find_keywords(text):

    keywords = rake.run(text)

    return_text = ""

    for keyword in keywords[:4]:
        return_text += f"<p>{keyword[0]}: score: {round(keyword[1],2)}</p>"

    return return_text
Exemplo n.º 2
0
def find_keywords(text):

    keywords = rake.run(text)

    return_text = ""

    for keyword in keywords[:4]:
        return_text += f"<p>{keyword[0]}: score: {round(keyword[1],2)}</p>"

    return return_text
Exemplo n.º 3
0
import rake
if True:
    f = open("result_pdf.txt", 'r')

    text = f.read()

    rake = rake.Rake("SmartStoplist.txt")
    keywords = rake.run(text)
    f.close()
    print("keyword word_score")
    for keyword in keywords:

        print keyword[0], keyword[1]
Exemplo n.º 4
0
import rake
import operator
import os

basedir = "/home/j9/Desktop/archextract/public/src_corpora/John_Muir/input"

# EXAMPLE ONE - SIMPLE
stoppath = "SmartStoplist.txt"
# 1. initialize RAKE by providing a path to a stopwords file
# 2. run on RAKE on a given text
#sample_file = open(basedir +"john_muir_papers_txt_kt9z09s3bg.txt", 'r')
all_files = [
    os.path.join(dp, f) for dp, dn, filenames in os.walk(basedir)
    for f in filenames if os.path.splitext(f)[1] == '.txt'
]

textsFull = []
count = 0

for doc in all_files:
    docfile = open(doc, 'r')
    text = docfile.read()
    textsFull.append(text)

alltxt = " ".join(textsFull)
rake = rake.Rake("SmartStoplist.txt")
keywords = rake.run(alltxt)
print keywords
Exemplo n.º 5
0
import rake
import operator
import os

basedir = "/home/j9/Desktop/archextract/public/src_corpora/John_Muir/input"

# EXAMPLE ONE - SIMPLE
stoppath = "SmartStoplist.txt"
# 1. initialize RAKE by providing a path to a stopwords file
# 2. run on RAKE on a given text
#sample_file = open(basedir +"john_muir_papers_txt_kt9z09s3bg.txt", 'r')
all_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk(basedir) for f in filenames if os.path.splitext(f)[1] == '.txt']


textsFull = []
count = 0

for doc in all_files:
  docfile = open(doc, 'r')
  text = docfile.read()
  textsFull.append(text)

alltxt = " ".join(textsFull)
rake = rake.Rake( "SmartStoplist.txt")
keywords = rake.run(alltxt )
print keywords
Exemplo n.º 6
0
import rake
if True:
    f = open("result_pdf.txt",'r')
    
    text = f.read()
    
    rake = rake.Rake("SmartStoplist.txt")
    keywords = rake.run(text)
    f.close()
    print("keyword word_score")
    for keyword in keywords:  
        
        print keyword[0],keyword[1]