come up with a method of potentially detecting passages that mention both Russia and…
- User
come up with a method of potentially detecting passages that mention both Russia and Ukraine, or the conflict between the two countries. it doesn't have to be sophisticated
Assistant
Of course. Here is a simple but effective method for detecting passages that mention Russia, Ukraine, or the conflict between them.
This method is based on keyword co-occurrence, meaning it looks for passages where words from different categories appear together.
The Method: A Three-Bucket Keyword Approach
The core idea is to define three lists (or "buckets") of keywords. A passage is flagged as potentially relevant if it contains keywords from at least two of these three buckets.
Step 1: Create Your Keyword Buckets
Bucket A: Russia-Related Terms
- Russia
- Russian
- Kremlin
- Moscow (as the government)
- Putin
- Wagner Group
Bucket B: Ukraine-Related Terms
- Ukraine
- Ukrainian
- Kyiv (and its alternative spelling, Kiev)
- Zelenskyy (and its alternative spellings, Zelensky, Zelenskyi)
- Donbas
- Crimea
- Lviv, Kharkiv, Kherson, Mariupol (add other key cities as needed)
Bucket C: Conflict-Related Terms
- war
- invasion
- conflict
- attack
- troops
- forces
- military
- aggression
- special military operation
- missile
- drone
- shelling
- battle
- front line
You can easily expand these lists with more specific names, locations, and terminology.
Step 2: Define a "Passage"
Decide what you consider a "passage." A good starting point is a single paragraph. A paragraph is a natural container for a single idea.
Alternatively, you could define a passage as:
- A single sentence.
- A "sliding window" of a certain number of words (e.g., any 100-word chunk).
A paragraph is usually the most balanced choice.
Step 3: Apply the Detection Rules
For each passage (e.g., each paragraph) in your document, check if it meets any of the following conditions:
-
Does it contain at least one word from Bucket A AND at least one word from Bucket B?
- Example: "The latest report from Kyiv suggests that Russian forces are regrouping." (Flagged)
-
Does it contain at least one word from Bucket A AND at least one word from Bucket C?
- Example: "The Kremlin's special military operation has met with stiff resistance." (Flagged)
-
Does it contain at least one word from Bucket B AND at least one word from Bucket C?
- Example: "Ukrainian troops have successfully repelled an attack near Kharkiv." (Flagged)
If the answer is "yes" to any of these questions, the passage is flagged for review.
Example in Action
Let's analyze this sample text:
The international community is closely watching the situation unfold. The war in Ukraine has led to a major humanitarian crisis. Russian advances in the Donbas region have slowed, according to Western intelligence. Meanwhile, President Zelenskyy has called for more military aid to help his troops defend their land. A separate report on global wheat prices mentioned both Russia and Ukraine as major exporters.
Analysis:
- Paragraph 1: Contains "war" (Bucket C), "Ukraine" (Bucket B), "Russian" (Bucket A), "Donbas" (Bucket B), "Zelenskyy" (Bucket B), and "troops" (Bucket C). It matches all three rules. Result: Flagged.
- Paragraph 2: Contains "Russia" (Bucket A) and "Ukraine" (Bucket B). It matches Rule #1. Result: Flagged.
Strengths and Weaknesses of this Method
Strengths:
- Simple to Implement: You don't need complex AI or machine learning. This can be done with a simple script or even a "find" function.
- Fast: It runs very quickly, even on large amounts of text.
- Surprisingly Effective: It will catch the vast majority of direct mentions of the conflict.
Weaknesses:
- False Positives: The second paragraph in the example ("...report on global wheat prices...") is a good example. It's about Russia and Ukraine but not the conflict. The method flags it correctly by its rules, but the context is economic, not military.
- Context Blind: It can't understand nuance, sarcasm, or negation. A sentence like "There is no war between Russia and Ukraine" would still be flagged.
- Misses Nuanced Language: A passage that says "Moscow's aggression against its neighbor" without using any other keywords might be missed if "Moscow" and "aggression" aren't on your lists. The keyword lists need to be fairly comprehensive.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.