diff --git a/src/guiguts/word_frequency.py b/src/guiguts/word_frequency.py index 11563201..26dfe6f9 100644 --- a/src/guiguts/word_frequency.py +++ b/src/guiguts/word_frequency.py @@ -785,14 +785,18 @@ def goto_word( # Also, boundary for an emdash is any non-emdash, but for other non-word characters the # boundary is a word/space character emdash_bound = "—" if newline_word[0] == "—" else r"[^\w\s]" + # If word contains space, then permit boundary character to be a hyphen + # (by not having it in the excluded characters) + # e.g. "school teacher" will match "Sunday-school teacher" + hyph_bound = "" if " " in newline_word else "-" left_boundary = ( - r"(?