改变Quanteda KWIC中ContextPre和ContextPost的长度

Change the length of ContextPre and ContextPost in Quanteda KWIC

有没有办法增加Quanteda kwic函数中关键字前后出现的单词数?

我试过更改以下数值:

options(width = 200)

但是没用。 @KenBenoit

options(width) 影响 R 解释器显示的文本列数。你想要 window 参数到 kwic():

>  kwic(data_corpus_inaugural, "war against")
                                               contextPre     keyword                         contextPost
 [1857-Buchanan, 2933:2934] advantage of the fortune of [ war against ] a sister republic, we
 [1901-McKinley, 2284:2285]         . We are not waging [ war against ] the inhabitants of the Philippine
 [1901-McKinley, 2299:2300]  portion of them are making [ war against ] the United States. By
 [1901-McKinley, 2413:2414]    used when those who make [ war against ] us shall make it no
[1933-Roosevelt, 1851:1852]   Executive power to wage a [ war against ] the emergency, as great
>  kwic(data_corpus_inaugural, "war against", window=7)
                                                       contextPre     keyword                                  contextPost
 [1857-Buchanan, 2933:2934] to take advantage of the fortune of [ war against ] a sister republic, we purchased these
 [1901-McKinley, 2284:2285]      be deceived. We are not waging [ war against ] the inhabitants of the Philippine Islands.
 [1901-McKinley, 2299:2300]      . A portion of them are making [ war against ] the United States. By far the
 [1901-McKinley, 2413:2414]  needed or used when those who make [ war against ] us shall make it no more.
[1933-Roosevelt, 1851:1852]   - broad Executive power to wage a [ war against ] the emergency, as great as the