Extractive text summarization using TextRank and RAKE.
Hosted for demo purposes only. Please host your own server if you require consistent performance.
enum TextRankSelections {
Text = 'text',
Sentences = 'sentences',
Ranks = 'ranks',
}
enum RakeSelections {
Text = 'text',
Sentences = 'sentences',
Ranks = 'ranks',
Keywords = 'keywords',
}
Endpoint: https://summsumm.herokuapp.com/summary/url/
POST Request body:
interface UrlRequest {
url: string;
selections: {
textRank?: TextRankSelections[];
rake?: RakeSelections[];
}
}
- API will return the requested selections only
Endpoint: https://summsumm.herokuapp.com/summary/text/
POST Request body:
interface TextRequest {
text: string;
selections: {
textRank?: TextRankSelections[];
rake?: RakeSelections[];
}
}
- API will return the requested selections only
interface Response {
textRank?: TextRankResponse;
rake?: RakeResponse;
}
// response is based on selections made in request
interface TextRankResponse {
text?: string;
sentences?: string[];
ranks?: Rank[]; // shown below
}
interface RakeResponse {
text?: string;
sentences?: string[];
ranks?: Rank[]; // shown below
keywords?: KeywordScore[]; // shown below
}
interface Rank {
sentenceIndex: number;
sentence: string;
rank: number;
keywords?: string[];
score?: number;
}
interface KeywordScore {
keyword: string;
degree: number;
frequency: number;
degFreq: number;
}
Uses Google's PageRank algorithm but instead of webpages, it ranks sentences. Cosine similarity is used to compute the similarity of sentences.
Method for summarization that extracts keywords from text and then computes a score for each word. Each sentence has a score of the sum of its keyword's scores. The sentences are then ranked by the sentence score. Tends to give preference to longer keywords and sentences