# Problem in constructing co-occurence matrix

I have a basic doubt in construction of co-occurence matrix from text. Coocurence matrix X is defined as :

Xij : number of times word i occurs in context of word j in a window of size w.

Now is this context limited to sentence i.e do we context word of a main word in a sentence only or across the whole document?

For ex:

Consider the corpus :

human interface computer
survey user computer system response time
eps user interface system
system human system eps
user response time
trees
graph trees
graph minors trees
graph minors survey
I like graph and stuff
I like trees and stuff
Sometimes I build a graph
Sometimes I build trees


Now for word graph and context window 10 do we look for only 4th last line or do we search for words across line also considering whole doc as one line?