thank you for your detailed answer. Unfortunately, by carefully reading my previous post, maybe I was not able to explain what I had in mind. Thus, I will try to reformulate my question in a less unspecific way.
I run some queries for analyzing the co-occurrences of a set of keywords. Such keywords were coupled by means of the AND operator, according to the boolean logic. Results from each query were graphically analyzed through the pertinent couple word trees. Anyway, I would like to enrich such graphical results with a numerical result, that is, the frequency of these co-occurrences. In detail, my current problem is the following one:
I have two keywords: KeywordA, KeywordB. I define a proximity threshold equal to n, and I search for "KeywordA AND KeywordB" in a specified set of papers by means of the word tree function. Then, I would like to check for the number of times this co-occurrence (KeywordA AND KeywordB with proximity equal to n) occurs: "How could I figure out the frequency of such co-occurrence?". Therefore, the output I'm searching for is a number, because I would like to perform a sensitivity analysis to observe how this frequency varies by changing the proximity threshold.
Hoping to have been clear, I look forward to reading your answer and I apologize for the previous misunderstanding