root/gapp/pangramming/utils.py

Revision 7cdcb8409bf6c806d19d3c1816a27e8eb22cff9a, 457 bytes (checked in by Antonio Cavedoni <antonio@…>, 8 months ago)

Adding Google App Engine version (testing toy)

  • Property mode set to 100644
Line 
1import re
2
3pangram_r = re.compile(r'[^A-Za-z]', re.UNICODE)
4tags_r = re.compile(r'\<.*?\>|^http://(?:.*?)\.[a-z]{1,6}', re.UNICODE)
5
6def bare_pangram(pangram):
7    return pangram_r.sub('', pangram.lower())
8
9def is_pangram(pangram):
10    alphabet = 'abcdefghijklmnpqrstuvwxyz'
11    for letter in alphabet:
12        if letter not in pangram.lower():
13            return False
14    else:
15        return True
16
17def strip_tags(input):
18    return tags_r.sub('', input)
Note: See TracBrowser for help on using the browser.