Not sure where to post this but it's an AI question

Joined
Mar 27, 2023
Messages
1
Reaction score
0
I am interested in an AI program that summarizes kindle books in the kindle library (maybe 5-10 page summary or something like that). There are programs that summarize PDFs but I haven't seen one for kindle. I would be interested in knowing if anyone has heard of this program or I would pay someone for it for a reasonable price.
 
Joined
Mar 31, 2023
Messages
95
Reaction score
8
Hello, blahman
I am interested in your question and I am trying to find a solution.
 
Joined
Mar 31, 2023
Messages
95
Reaction score
8
Python:
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize, sent_tokenize
from nltk.probability import FreqDist
from heapq import nlargest

# Load the contents of the file into a text variable
with open('path/to/your/file.txt', 'r') as file:
    texte = file.read()
sent_tokens = sent_tokenize(texte)
word_tokens = word_tokenize(texte)

stop_words = set(stopwords.words('french'))
punctuations = ['.', ',', '!', '?', ';', ':']
filtered_words = [word for word in word_tokens if word.lower() not in stop_words and word not in punctuations]

freq_dist = FreqDist(filtered_words)

ranking_sentences = []
for i, sentence in enumerate(sent_tokens):
    sentence_score = 0
    for word in word_tokenize(sentence):
        if word.lower() in freq_dist:
            sentence_score += freq_dist[word.lower()]
    ranking_sentences.append((sentence_score, i))
    
n = int(len(sent_tokens) / 3)
summary_sentences = nlargest(n, ranking_sentences)
summary_sentences.sort(key=lambda x: x[1])

summary = ""
for i in range(n):
    summary += sent_tokens[summary_sentences[i][1]] + " "

print(summary)
Here is a code example that can make a summary of a word or other document. If you want to make a summary of a kindle book it will be much harder. Can you tell me what to use to do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top