From 7d5e84b7be927f9f9d9027c89bb385aef7abedcb Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:11:11 -0400 Subject: [PATCH] fix: don't include duplicate lemmas in match activity token set (#4498) --- lib/pangea/practice_activities/practice_selection.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pangea/practice_activities/practice_selection.dart b/lib/pangea/practice_activities/practice_selection.dart index 69810def7..00f8b7a2a 100644 --- a/lib/pangea/practice_activities/practice_selection.dart +++ b/lib/pangea/practice_activities/practice_selection.dart @@ -162,8 +162,11 @@ class PracticeSelection { //remove duplicates final seenTexts = {}; + final seemLemmas = {}; tokens.retainWhere( - (token) => seenTexts.add(token.text.content.toLowerCase()), + (token) => + seenTexts.add(token.text.content.toLowerCase()) && + seemLemmas.add(token.lemma.text.toLowerCase()), ); if (tokens.length > 8) { @@ -184,6 +187,8 @@ class PracticeSelection { activityTokens.add(t); } + debugPrint("TOKENS: ${activityTokens.map((e) => e.text.content).toList()}"); + return [ PracticeTarget( activityType: activityType,