How to search "all" (not any) multiple context words?

137 views
Skip to first unread message

Illia Ilyin

unread,
Jun 9, 2022, 1:31:16 PM6/9/22
to AntConc-Discussion
Dear AntConc community! Please, help me to resolve the issue of searching all multiple context words. I want to find "Ukraine" with context words "Russia" and "threat" simultenuosly in one context, not separate instances of "Ukraine" with "Russia", and "Ukraine" with "threat". I've tried to use Regex for this matter, but I couldn't understand how to search these context words both before and after the node word in the space of 20 tokens. Thanks in advance. Regards, Illia.

Laurence Anthony

unread,
Jun 9, 2022, 8:22:51 PM6/9/22
to ant...@googlegroups.com
Hi Illia,

This is a good question. In AntConc, this is not possible (at the moment) as the context search query is an "or/any" option (not an "all" option). But, you can achieve what you want relatively easily. I suggest you do *two* searches, one with "Russia" and one with "threat" copying the results to Excel. Then, in Excel, it is relatively easy to keep just the duplicates.

I'll certainly consider adding a toggle to switch between "or/any" and "and" in the next release.

I hope that helps!

Laurence.

###############################################################
Laurence ANTHONY, Ph.D.
Professor of Applied Linguistics
Faculty of Science and Engineering
Waseda University
3-4-1 Okubo, Shinjuku-ku, Tokyo 169-8555, Japan
E-mail: antho...@gmail.com
WWW: http://www.laurenceanthony.net/
###############################################################


On Fri, 10 Jun 2022 at 02:31, Illia Ilyin <i.v.il...@gmail.com> wrote:
Dear AntConc community! Please, help me to resolve the issue of searching all multiple context words. I want to find "Ukraine" with context words "Russia" and "threat" simultenuosly in one context, not separate instances of "Ukraine" with "Russia", and "Ukraine" with "threat". I've tried to use Regex for this matter, but I couldn't understand how to search these context words both before and after the node word in the space of 20 tokens. Thanks in advance. Regards, Illia.

--
You received this message because you are subscribed to the Google Groups "AntConc-Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antconc+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/antconc/823e2ea2-26d6-4bd6-9af8-e425e3d98a8an%40googlegroups.com.

Illia Ilyin

unread,
Jun 10, 2022, 4:56:22 AM6/10/22
to AntConc-Discussion
Hi Laurence! 

Thank you very much! 

I've tried this method, but still got occurences without "Russia" or "threat" even without dublicates. Maybe I'm using Excel incorrectly. I will be grateful for your help! 

Warm regards, Illia.

пятница, 10 июня 2022 г. в 03:22:51 UTC+3, Laurence Anthony:

Laurence Anthony

unread,
Jun 10, 2022, 6:54:43 AM6/10/22
to ant...@googlegroups.com
Hi,

I suggest you proceed one step at a time. Generate results that all contain "Russia". If you cannot do this, you certainly cannot proceed to the next step. Second, generate results that all contain "threat". Put the results of the first and second step together. If you can get to this point, then you just need to know how to find the duplicates in Excel.

Regards,

Laurence.

###############################################################
Laurence ANTHONY, Ph.D.
Professor of Applied Linguistics
Faculty of Science and Engineering
Waseda University
3-4-1 Okubo, Shinjuku-ku, Tokyo 169-8555, Japan
E-mail: antho...@gmail.com
WWW: http://www.laurenceanthony.net/
###############################################################

Illia Ilyin

unread,
Jun 10, 2022, 2:55:23 PM6/10/22
to AntConc-Discussion
Dear prof. Anthony! 

Yes, I did everything exactly like you've said from the beginning, but I'm not happy with results. There are 2407 concordances with Ukraine+Russia, and 269 concordances with Ukraine+threat. After deleting duplicates, I received 2538 concordances. Obviously it's not the result I wanted because there are concordances with Ukraine+Russia and Ukraine+threat, but not Ukrain+Russia+threat. I'm uploading my files. 

Thank you for your help. 

Regards, Illia.

пятница, 10 июня 2022 г. в 13:54:43 UTC+3, Laurence Anthony:
Ukrain+Threat.xlsx
Ukrain+Russia.xlsx
Ukrain+Russia+Threat.xlsx

Laurence Anthony

unread,
Jun 10, 2022, 8:48:04 PM6/10/22
to ant...@googlegroups.com
Hi again,

Why are you *deleting* the duplicates? As I explain in the first response, you need to *keep* the duplicates  (and delete the rest) as they are the ones that contain both hits.

Laurence.

###############################################################
Laurence ANTHONY, Ph.D.
Professor of Applied Linguistics
Faculty of Science and Engineering
Waseda University
3-4-1 Okubo, Shinjuku-ku, Tokyo 169-8555, Japan
E-mail: antho...@gmail.com
WWW: http://www.laurenceanthony.net/
###############################################################

Illia Ilyin

unread,
Jun 11, 2022, 8:25:42 AM6/11/22
to AntConc-Discussion
Dear prof. Anthony! 

It's my bad! Thank you for you patience and help! I managed to get it right! 

Sincerely yours, Illia.

суббота, 11 июня 2022 г. в 03:48:04 UTC+3, Laurence Anthony:

Laurence Anthony

unread,
Jun 11, 2022, 8:51:08 AM6/11/22
to ant...@googlegroups.com
That's great! Removing the non-duplicates, and then reducing the duplicates down to one of each is the key. Did you find how to do this in one click in Excel? It's possible but uses a feature that not everybody knows about.

Laurence.

###############################################################
Laurence ANTHONY, Ph.D.
Professor of Applied Linguistics
Faculty of Science and Engineering
Waseda University
3-4-1 Okubo, Shinjuku-ku, Tokyo 169-8555, Japan
E-mail: antho...@gmail.com
WWW: http://www.laurenceanthony.net/
###############################################################

Illia Ilyin

unread,
Jun 11, 2022, 8:55:12 AM6/11/22
to AntConc-Discussion
Actually, I didn't. Could you, please, give me a hint how to do this? Thanks in advance.

суббота, 11 июня 2022 г. в 15:51:08 UTC+3, Laurence Anthony:

Laurence Anthony

unread,
Jun 11, 2022, 9:30:10 AM6/11/22
to ant...@googlegroups.com
I won't explain the whole procedure in detail because this is an AntConc discussion group (not an Excel discussion group!), but basically you need to use the Power Query Option:


1) Open Excel
2) Open Power Query (Data > Get Data > Launch Power Query Editor)
3) Choose your Excel table (New Source->File->Excel Workbook->Your file
4) In the new window, click Preview (to see the data) and OK to load the data
5) Select the column of data (the Kwic concordance results - merged into a single cell for each row)
6) In the ribbon, expand "Keep Rows" and select "Keep Duplicates" (this will remove the single entries)
7) In the ribbon, expand "Remove Rows" and select "Remove Duplicates" (this will remove one of each duplicate)
8) Click "Close and Load" in the ribbon to go back to the Excel worksheet

Once you know this, you can do it all in about 5 sec.

I hope this helps!

Laurence.

p.s. I really should make it an option in the AntConc advanced search settings. I would expect few people would know how to do the above unless they were a power user of Excel.

###############################################################
Laurence ANTHONY, Ph.D.
Professor of Applied Linguistics
Faculty of Science and Engineering
Waseda University
3-4-1 Okubo, Shinjuku-ku, Tokyo 169-8555, Japan
E-mail: antho...@gmail.com
WWW: http://www.laurenceanthony.net/
###############################################################

Illia Ilyin

unread,
Jun 11, 2022, 9:36:22 AM6/11/22
to AntConc-Discussion
Thank you for the instructions. Sorry for my ignorance! It will be wonderful, if you add this option to AntConc! Thanks in advance!

суббота, 11 июня 2022 г. в 16:30:10 UTC+3, Laurence Anthony:
Reply all
Reply to author
Forward
0 new messages