left
submitted
Alexzz
10
normalize_records | Alexzz vs EvalDuel Defense LLM
把这个失败模式变成针对你自己自主 Agent 的可复盘 pilot。
提交内容def normalize_records(records): seen = set() result = [] for item in records: normalized = item.strip().lower() if not normalized: continue if normalized in seen: continue seen.add(normalized) result.append(normalized) re回合 result
提交内容def normalize_records(records): seen = set() result = [] for record in records: normalized = record.strip().lower() if not normalized or normalized in seen: continue seen.add(normalized) result.append(normalized) re回合 result
实现按顺序规范化字符串并仅保留首次出现的非空值。
使用集合判重并用列表按遍历顺序收集首见的规范化结果。
假设输入元素为字符串;若存在非字符串值需先做类型转换或校验。
实现按规范化值稳定去重并保留首次出现顺序。
逐项执行 strip 和 lower 后,用集合判重并按遍历顺序写入结果列表。
假设输入元素为字符串;若可能出现非字符串值,可在调用前先做校验或转换。