# If we read two strings separated by weird punctuation,
# pretend the punctuation isn't there.
if (this_mode == previous_mode == LETTER
- and prev_category[0] == "P"
+ and (category[0] == "P" or prev_category[0] == "P")
and words):
words[-1] += u" " + string[start:last+1]
else:
last = None
if category[0] in "LN":
last = i
+ this_mode = mode
if start is not None and last is not None:
- if this_mode == previous_mode == LETTER and words:
+ if this_mode == LETTER and previous_mode == LETTER and words:
words[-1] += u" " + string[start:last+1]
else:
if this_mode == NUMBER and previous_mode == LETTER and words: