Skip to content

Commit

Permalink
remove duplicate error spans function
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravnavani committed Aug 6, 2024
1 parent f183b43 commit 3f15a53
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions validator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,21 +195,6 @@ def find_all(a_str, sub):
reason=f"Competitor found: {value[start:start+len(entity)]}",
)
)
def find_all(a_str, sub):
start = 0
while True:
start = a_str.find(sub, start)
if start == -1:
return
yield start
start += len(sub) # use start += 1 to find overlapping matches

error_spans = []
for entity in found_entities:
starts = list(find_all(value, entity))
for start in starts:
error_spans.append(ErrorSpan(start=start, end=start+len(entity), reason=f'Competitor found: {value[start:start+len(entity)]}'))


if len(flagged_sentences):
return FailResult(
Expand Down

0 comments on commit 3f15a53

Please sign in to comment.