Created
June 8, 2016 02:28
-
-
Save xumx/08ab08266100659086743ab45ee2933a to your computer and use it in GitHub Desktop.
Trick for charRNN to represent capitalization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
s = 'Hello World' | |
re.sub( '([A-Z])', '^\\1', s ).lower() | |
#reverse | |
s1 = "^hello ^world" | |
re.sub( '\^(.)', lambda match: match.group( 1 ).upper(), s1 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment