Spaces:
Running
Running
feat(text): handle dates & prices
Browse files- dalle_mini/text.py +3 -3
dalle_mini/text.py
CHANGED
@@ -144,8 +144,8 @@ def handle_special_chars(t):
|
|
144 |
"Handle special characters"
|
145 |
# replace "-" with a space when between words without space
|
146 |
t = re.sub("([a-zA-Z])-([a-zA-Z])", r"\1 \2", t)
|
147 |
-
# always add space around & or %
|
148 |
-
return re.sub("([
|
149 |
|
150 |
|
151 |
def expand_hashtags(t, hashtag_processor):
|
@@ -153,7 +153,7 @@ def expand_hashtags(t, hashtag_processor):
|
|
153 |
return re.sub("#(\w+)", lambda m: " , " + hashtag_processor(m.group(1)), t)
|
154 |
|
155 |
|
156 |
-
_re_ignore_chars = """[_
|
157 |
|
158 |
|
159 |
def ignore_chars(t):
|
|
|
144 |
"Handle special characters"
|
145 |
# replace "-" with a space when between words without space
|
146 |
t = re.sub("([a-zA-Z])-([a-zA-Z])", r"\1 \2", t)
|
147 |
+
# always add space around & or % or / or $
|
148 |
+
return re.sub("([%&\/$])", r" \1 ", t)
|
149 |
|
150 |
|
151 |
def expand_hashtags(t, hashtag_processor):
|
|
|
153 |
return re.sub("#(\w+)", lambda m: " , " + hashtag_processor(m.group(1)), t)
|
154 |
|
155 |
|
156 |
+
_re_ignore_chars = """[_#\\]"""
|
157 |
|
158 |
|
159 |
def ignore_chars(t):
|