I am trying to formulate a search request that will show me example sentences for sentences that contain the phrase "In the beginning" or "At the beginning" followed by the word "word" with a distance of 2 to 4 words. I am using the German corpus DeReKo if that is important.

My current search request looks like this but only shows results that contain "In the beginning" and none with "at the beginning": In /+w1 the /+1 beginning /+w2:5 word OR At /+w1 the /+w1 beginning /+w2:5 word

How should I rephrase my search request so that I will get results for both formulations? Or this is not possible and I have to use two separate searches?

1 Answer 1


I don't know how your corpus is prepared and what the query language is, but it is in principle feasible using regular expressions.

Here is the query in the cqp query language used, e.g., by the open corpus work bench:

[word="[Ii]n" | word="[Aa]t"] [word="the"] [word="beginning"] [] []? []? [word="word"]

Explanation: In the first token we search for in or at and care for potential capitalisation, the next two tokens are straightforward. Than comes at least one intervening token and two optional ones (the range operator []{1,3} should work according to the documentation, but on a cqpweb installation where I tested it, it threw an error, therefore the cludge with []? []?) and at last comes the word searched for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.