Please help me someone as to how to find frequency of each query term in a specific document in PHP. e.g. we have 2 files:
Query.txt contains data "to be not"
Data.txt contains data "to be or not to be. what to be. everything else to be."
And I need to read the file query.txt and collect terms from that file that are {"to","be"} and find the frequency of these terms in the file data.txt and if there is way to retrieve their positions too.
Result would be probably like that:
"to" appeared 4 times "be" appeared 4 times "not" appeared 1 times
Regards,
I believe this is what you want.
PHP:
PHP with Highlight: