I want to build a keyword extractor based on the TextRank model as explained in RMPT04. But I don't understand how to calculate the co-occurrence between two words in a window of text explained in the point 3.1. Moreover, is a corpus necessary?
Of course you need a corpus.
Generally in statistical NLP, you train your model based on a corpus. For example, for text classification where an input document is fed to the model and it should output its class (from a list of classes). The model is trained on many documents with their corresponding classes and when the new document is tested under that model, it will use the features (information) which was extracted from those documents to classify the new document.
In the case of co-occurrence of two words, you can use context-vector, which is very common in statistical NLP. It has a simple definition and very easy to implement, but you will need a corpus:
You will define a vector with fixed length (the number of unique words in your corpus) for each unique word in your corpus. The context vector for each word tells us how many times other words have co-occurred with the current word in the defined window, e.g. in a window of words, you see what are the other words occurred with the current word and increment their corresponding element in the context vector. A simple example is show below:
Corpus: A D C E A D F E B A C E D
Window size: 2 (the 2 words of the either side)
A B C D E A 0 1 3 2 3 B 1 0 1 0 1 C 3 1 0 2 2 D 2 0 2 0 4 E 3 1 2 4 0
Using these context vectors you can get co-occurrences very easy. For example co-occurrence of D and E is D[E] = 4.