This is one of the document classification tasks and supervised learning can be used to solve it.
if the domain of the test data is different from the domain for the learning data (for example, book reviews), the accuracy of the classifier obtained through standard supervised learning reduced.