![image.png|1000](https://imagehosting4picgo.oss-cn-beijing.aliyuncs.com/imagehosting/fix-dir%2Fpicgo%2Fpicgo-clipboard-images%2F2025%2F01%2F23%2F23-51-26-fa9ce9e797c46268061f112c551e302e-202501232351103-bd79d0.png) 这个值为1是因为在上方显示的英汉混合句子中 all 和 that 这两个词是相邻的。 在这个位置标记为1表示这两个词在文本中作为相邻词出现了一次 ## 窗口大小 不是的,让我来澄清一下窗口大小的定义: 当我们说窗口大小(window size) n=1 时: - 只看当前词左边1个词和右边1个词 - 所以整个窗口大小实际是2(不包含中心词本身) 例如对于句子 "all that glitters is not gold": 当 n=1 时,对中心词 "glitters" 的扫描是: ```Java ... [that] glitters [is] ... ↑ ↑中心词 ↑ 左1 右1 ``` 当 n=2 时,对中心词 "glitters" 的扫描是: ```Java [all] [that] glitters [is] [not] ... ↑ ↑ ↑中心词 ↑ ↑ 左2 左1 右1 右2 ``` 所以: - 窗口大小 n 表示单侧看的词数 - 总的上下文窗口长度 = 2n (两侧各n个词) - 不计算中心词本身 这就是为什么在共现矩阵的例子中,当 n=1 时: - that 只和 all、glitters 有共现关系 - is 只和 glitters、not 有共现关系 - 更远的词不计入共现统计 希望这个解释能帮助你更好地理解窗口大小的概念。