Skip to content

Instantly share code, notes, and snippets.

@FrankFonts
Created April 14, 2015 20:21
Show Gist options
  • Save FrankFonts/f07cea8d560c54e359dc to your computer and use it in GitHub Desktop.
Save FrankFonts/f07cea8d560c54e359dc to your computer and use it in GitHub Desktop.
Context Aware Delimiter_030.py
dict={
'cap' : 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z'.split(' '),
'lowercase' : 'a b c d e f g h i j k l m n o p q r s t u v w x y z'.split(' ')
}
def find(this, dictionary):
for key in dictionary.keys():
if this in dictionary[key]:
return key
def findOrGuess(this, dictionary):
delim = find(this, dictionary)
if delim == None:
this = this[0]
delim = find(this, dictionary)
if delim == None:
delim = 'H'
return delim
x = 'eogonek'
print findOrGuess(x, dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment