inverse_index.Rd
If we are interested in a specific term, we often want to know which documents in a corpus contain that term. The inverse index tells us this and therefore provides a simplistic sort of search algorithm.
Tells the size of the inverse index.
inverse_index(corpus) update_inverse_index(corpus) # S3 method for corpus inverse_index(corpus) # S3 method for corpus update_inverse_index(corpus) inverse_index(corpus) # S3 method for corpus inverse_index(corpus)
corpus | A corpus, as returned vy |
---|
# NOT RUN { init_textanalysis() # build document doc1 <- string_document("First document.") doc2 <- string_document("Second document.") # do not update automatically corpus <- corpus(doc1, doc2, update_inverse_index = FALSE) # update manually update_inverse_index(corpus) inverse_index(corpus) # }# NOT RUN { init_textanalysis() # build document doc1 <- string_document("First document.") doc2 <- string_document("Second document.") corpus <- corpus(doc1, doc2) update_inverse_index(corpus) inverse_index(corpus) # }