Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6fce802

Browse files
committed
improve return tuple
1 parent ea5a720 commit 6fce802

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

14_rhymer/rhymer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def test_stemmer():
3434

3535
def stemmer(word):
3636
pattern = '([' + consonants() + ']+)?(.*)?'
37-
(res1, rest2) = map(lambda x: x or '', re.match(pattern, word.lower()).groups())
37+
match = re.match(pattern, word.lower())
3838

39-
return (res1, rest2)
39+
return (match.group(1) or '', match.group(2) or '') if match else ('','')
4040

4141

4242
def consonants():

0 commit comments

Comments
 (0)