Further edit to original question.
Question originated by expectation that regexes would work identically or nearly to "grep" or to some programming language. This below is what I expected and the fact that it did not happen generated my question (using cygwin):
echo "regex unusual operation will deport into a different" > out.txt
grep "will * dep" out.txt
"regex unusual operation will deport into a different"
Originary question
Trying to follow
https://github.com/kbenoit/ITAUR/blob/master/README.md
to learn Quanteda after seeing that everybody that uses this package finds it very good.
In
demo.R, line 22 I find the line:
kwic(immigCorpus, "deport", window = 3)
Its output is -
[BNP, 157] The BNP will | deport | all foreigners convicted
[BNP, 1946] . 2. | Deport | all illegal immigrants
[BNP, 1952] immigrants We shall | deport | all illegal immigrants
[BNP, 2585] Criminals We shall | deport | all criminal entrants
To try/learn the basics I execute
kwic(immigCorpus, "will *depo", window = 3, valuetype = "regex")
expecting to get
[BNP, 157] The BNP will | deport | all foreigners convicted
but I get:
kwic object with 0 rows
Similar attempts like
kwic(immigCorpus, ".*will *depo.*", window = 3, valuetype = "regex")
Get the same result:
kwic object with 0 rows
Why is that? Tokenization? if so how should I write the regex?
PS Thanks for this great package
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…