Skip to content

Commit

Permalink
change quote-replacement of pattern """content""content"
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Streubel committed Jan 28, 2019
1 parent 82b6d79 commit db5f902
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/corporacreator/preprocessors/de.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import re
QUOTE_PATTERN = re.compile(r'^\"{3}(.*)\"{2}(.*)\"{1}$')
QUOTE_PATTERN_2 = re.compile(r'^\"{1}(.*)\"{2}(.*)\"{2}(.*)\"{1}$')
QUOTE_PATTERN_3 = re.compile(r'^\"{1}(.*)\"{1}')
QUOTE_PATTERN_3 = re.compile(r'^\"{1}(.*)\"{1}$')

def _change_multi_quotes(sentence):
"""Changes all quotes from patterns like
[\"""content""content"] to [content content] or
["content""content""content"] to [content "content" content] or
[\"""content""content"] to ["content"content] or
["content""content""content"] to [content"content"content] or
["content" to content]
Args:
Expand All @@ -21,7 +21,7 @@ def _change_multi_quotes(sentence):
matches3 = QUOTE_PATTERN_3.match(sentence) # patter: \"content\"

if matches != None and matches.lastindex == 2:
return "{}{}".format(matches.group(1), matches.group(2))
return "\"{}\"{}".format(matches.group(1), matches.group(2))
elif matches2 != None and matches2.lastindex == 3:
return "{}\"{}\"{}".format(matches2.group(1), matches2.group(2), matches2.group(3))
elif matches3 != None and matches3.lastindex == 1:
Expand Down

0 comments on commit db5f902

Please sign in to comment.