Skip to content

Commit df227db

Browse files
another fix for intersection logic (#63)
* another fix for intersection logic * increment version
1 parent fe1ac00 commit df227db

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tonic-textual"
3-
version = "3.10.7"
3+
version = "3.10.8"
44
description = "Wrappers around the Tonic Textual API"
55
authors = ["Adam Kamor <[email protected]>", "Joe Ferrara <[email protected]>", "Ander Steele <[email protected]>", "Ethan Philpott <[email protected]>", "Lyon Van Voorhis <[email protected]>", "Kirill Medvedev <[email protected]>", "Travis Matthews <[email protected]>"]
66
license = "MIT"

tonic_textual/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.10.7"
1+
__version__ = "3.10.8"

tonic_textual/helpers/redact_audio_file_helper.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,16 @@ def get_intervals_to_redact(
132132
word_end = word_obj.char_end
133133
# beep a word if it overlaps with the found span
134134
# this beeps entire word when span is part of a word
135+
# overlap can happen in three ways
136+
# way 1: either word is substring or span or word intersects on the right part of span
135137
if word_start < span_end and word_start >= span_start:
136138
intersecting_words.append(word_obj)
139+
# way 2: either word is substring or span or word intersects on the left part of span
137140
elif word_end > span_start and word_end <= span_end:
138141
intersecting_words.append(word_obj)
142+
# way 3: span is a substring of word
143+
elif span_start >= word_start and span_end <= word_end:
144+
intersecting_words.append(word_obj)
139145
elif word_start > span_end: # done
140146
break
141147
# if fail to find intersecting words continue

0 commit comments

Comments
 (0)