From 6cc8f2bddbe0ceb2fd4da4bc59e91d7a55fe9dd2 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Sun, 7 Apr 2019 18:43:37 -0500 Subject: [PATCH] added filter function using re --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index afd470f..7649c1e 100644 --- a/main.py +++ b/main.py @@ -11,3 +11,6 @@ def canidates(letters, min=2, max=5): pos.append(word) return SPELL.known(pos) +def filter_pos(pos, regex): + pat = re.compile(regex) + return list(filter(pat.match,pos))