# Q7c · Co-occurrence with inconsistent requested comparisons

Subject: Natural Language Processing

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/nlp/#tee/papers/legacy-r25/q7c

Canonical: https://deep-learning-study-room.vercel.app/read/nlp/tee/papers/legacy-r25--q7c/

Previous examination · complete worked answers

**Question. Construct a whole-sentence co-occurrence matrix for: The bird flew across the sky. The cat watched the bird. The flowers grew in the garden. The bird rested on the tree. The cat slept near the tree. Targets={bird,cat,garden,flowers}; contexts={sky,tree,garden,slept}. The printed follow-up asks dot products boy–dog and boy–sun and a plot on kicked/field dimensions.** [10 marks]

### Answer

### Given

Use the exact target/context lists above.

### To find

Construct the supported matrix and identify which later requests are undefined.

### Formula: which one and why

Count ordered target-token/context-token pairs in the same sentence, excluding the target token itself. A single garden occurrence cannot co-occur with itself. If a classroom convention uses sentence-level presence including diagonal, only garden→garden changes from0to1; state that choice.

### Step 1. Enumerate contributions and sum

| Sentence | Target occurrences | Context occurrences |
| --- | --- | --- |
| 1 | bird | sky |
| 2 | cat, bird |  |
| 3 | flowers, garden | garden |
| 4 | bird | tree |
| 5 | cat | slept, tree |

| Target / context | sky | tree | garden | slept |
| --- | --- | --- | --- | --- |
| bird | 1 | 1 | 0 | 0 |
| cat | 0 | 1 | 0 | 1 |
| garden | 0 | 0 | 0 | 0 |
| flowers | 0 | 0 | 1 | 0 |

### Step 2. Check requested names before multiplying

boy,dog,sun are not target rows; kicked,field are not context columns. Therefore the requested dot products and plot cannot be calculated from the supplied matrix. Zero vectors for invented words would not repair the missing givens.

### Step 3. Clearly labelled corrected illustration

If the follow-up were changed to bird–cat and bird–flowers, using the displayed rows: bird·cat=1×0+1×1+0×0+0×1=1; bird·flowers=1×0+1×0+0×1+0×0=0. A sky/tree plot would use bird(1,1),cat(0,1),garden(0,0),flowers(0,0). These substitutions are teaching examples, not printed instructions.

### Final answer

**The original matrix is solved; its requested boy/dog/sun comparisons and kicked/field plot are not well-defined.** Ask for corrected target/context names rather than inventing a numerical answer.

**Source / convention note.** Source defect: follow-up names belong to another corpus. Exact supported matrix is complete; unsupported parts are explicitly unresolved from the original data.
