sentenceSimil {lexRankr} | R Documentation |
Compute distance between sentences
Description
Compute distance between sentences using modified idf cosine distance from "LexRank: Graph-based Lexical Centrality as Salience in Text Summarization". Output can be used as input to lexRankFromSimil
.
Usage
sentenceSimil(sentenceId, token, docId = NULL, sentencesAsDocs = FALSE)
Arguments
sentenceId |
A character vector of sentence IDs corresponding to the |
token |
A character vector of tokens corresponding to the |
docId |
A character vector of document IDs corresponding to the |
sentencesAsDocs |
|
Value
A 3 column dataframe of pairwise distances between sentences. Columns: sent1
(sentence id), sent2
(sentence id), & dist
(distance between sent1
and sent2
).
References
http://www.cs.cmu.edu/afs/cs/project/jair/pub/volume22/erkan04a-html/erkan04a.html
Examples
sentenceSimil(docId=c("d1","d1","d2","d2"),
sentenceId=c("d1_1","d1_1","d2_1","d2_1"),
token=c("i", "ran", "jane", "ran"))