You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def overlaps(span1: Span, span2: Span) -> set:
"""
:param span1: 1st text Span
:param span2: 2nd text Span
:return: set of CHAR positions (convertible to range or Span)
"""
range1 = range(span1.begin, span1.end)
range2 = range(span2.begin, span2.end)
return set(range1).intersection(set(range2))
def overlaps(span1: Span, span2: Span, min_length=2, max_length=20) -> bool:
"""
True/False text overlap exists between two spans of 'highlighted' text.
:param span1: 1st text Span
:param span2: 2nd text Span
:param min_length: MIN length of comparison, default 2 chars
:param max_length: MAX length of comparison, default 20 chars (or equals)
:return: true/false the two spans overlap
"""
shared = intersect(span1, span2)
if len(shared) == len(range(span1.begin, span1.end)):
return True
elif (len(shared) >= min_length) and (len(shared) <= max_length):
return True
else:
return False
The text was updated successfully, but these errors were encountered:
comorbidity
changed the title
Improvmeent: helper method for testing Span overlaps
Improvment: helper method for testing Span overlaps
Aug 7, 2023
comorbidity
changed the title
Improvment: helper method for testing Span overlaps
Feature request: helper methods for testing Span overlaps
Aug 7, 2023
def overlaps(span1: Span, span2: Span) -> set:
"""
:param span1: 1st text Span
:param span2: 2nd text Span
:return: set of CHAR positions (convertible to range or Span)
"""
range1 = range(span1.begin, span1.end)
range2 = range(span2.begin, span2.end)
return set(range1).intersection(set(range2))
def overlaps(span1: Span, span2: Span, min_length=2, max_length=20) -> bool:
"""
True/False text overlap exists between two spans of 'highlighted' text.
The text was updated successfully, but these errors were encountered: