Thanks for reading. For a reserach project, I'm doing some text analysis. We are analyzing large texts (company reports) and I'm looking to count keyword frequencies within that text.
However, I have two lists of keywords, and I dont want to count the number of occurances of these words, but the number of times any two words from these lists appear within a certain distance from each other in the main text.
text <- c("The house is blue. The car is very big and red.")
words1 <- c("car", "house")
words2 <- c("blue", "red")
The desired functionality should, for example, return 1 for distance 3. (Number of any combinations in given distance.)
I know about the text_count function from the stringb package and kwic from quantea. However, thats not really what Im looking for.
Thanks, any help is appreciated.