In a broader sense, what you're referring to here is known as text mining. This is where information is extracted from text according to certain criteria in order to form specific patterns and meanings, etc.
How you would go about implementing this depends on the criteria you have in mind.
For instance, let's suppose you have a blog article in text format (let's call it filepath.txt for this example).
You decide that you wish to sort words into specific categories. For instance, you could categorise the keywords hotel, flights, countries, as travel, i.e. each incidence of the three words would be replaced with data. Let's assume data is a relevant category of interest. Any article that would fall under a travel category would be included in your articles of interest.
Using Python, you can then scan your file and use filedata.replace to replace your keywords with categories:
# Read file
with open('filepath.txt', 'r') as file :
filedata = file.read()
# Replace keyword
filedata = filedata.replace('How ', ' ')
filedata = filedata.replace('Why ', ' ')
filedata = filedata.replace('of ', ' ')
filedata = filedata.replace('to ', ' ')
filedata = filedata.replace('you ', ' ')
filedata = filedata.replace('all ', ' ')
filedata = filedata.replace('and ', ' ')
filedata = filedata.replace('be ', ' ')
filedata = filedata.replace(' a ', ' ')
filedata = filedata.replace(' for ', ' ')
filedata = filedata.replace(' in ', ' ')
filedata = filedata.replace(' is ', ' ')
filedata = filedata.replace(' the ', ' ')
filedata = filedata.replace(' about ', ' ')
filedata = filedata.replace(' an ', ' ')
filedata = filedata.replace('Data', ' data ')
filedata = filedata.replace('Python', ' data ')
filedata = filedata.replace('R', ' data ')
filedata = filedata.replace('machine', ' data ')
filedata = filedata.replace('Linux', ' data ')
filedata = filedata.replace('technology', ' data ')
filedata = filedata.replace('flights', 'travel')
filedata = filedata.replace('countries', 'travel')
filedata = filedata.replace('hotel', 'travel')
filedata = filedata.replace('analytics', 'data')
filedata= filedata.replace('CNN', 'news')
filedata= filedata.replace('weather', 'news')
filedata= filedata.replace('Trump', 'news')
filedata= filedata.replace('market', 'business')
filedata= filedata.replace('entrepreneur', 'business')
filedata= filedata.replace('financial', 'business')
# Write to file
with open('filepath2.txt', 'w') as file:
file.write(filedata)
You could then use a library such as stringr in R to see how frequently the category (which would have the keywords replaced with the category) appears:
require(stringr)
WordList <- str_split(readLines("filepath2.txt"), pattern = " ")
searchqueries<-sort(table(WordList),decreasing=TRUE)[1:100]
searchqueries
e.g. if the category appears X number of times or more, then the article is deemed relevant.
This is just one example of how you could use text mining. Again, much of it hinges on your specific criteria and how you would go about determining relevancy. But that's one way you could approach it.