MCPcopy Create free account
hub / github.com/debjitpaul/refiner / has_overlap

Function has_overlap

data_preprocessing/utils.py:114–116  ·  view source on GitHub ↗
(source: str, target: str, threshold: float, ignore_stopwords: bool = False, ignore_entities: bool = False)

Source from the content-addressed store, hash-verified

112 return overlap, (len(overlap) / len(target_words)) if overlap else 0, (len(overlap) / len(source_words)) if overlap else 0
113
114def has_overlap(source: str, target: str, threshold: float, ignore_stopwords: bool = False, ignore_entities: bool = False):
115 _, overlap_level1, overlap_level2 = get_overlap(source, target, ignore_stopwords=ignore_stopwords, ignore_entities=ignore_entities)
116 return overlap_level1 > threshold or overlap_level2 > threshold
117
118def has_story_overlap(head: str, tail: str, story: str, threshold: float, selected_context: str = None, dim: int = 1,
119 ignore_stopwords: bool = False, ignore_entities: bool = False) -> bool:

Callers 1

has_story_overlapFunction · 0.85

Calls 1

get_overlapFunction · 0.85

Tested by

no test coverage detected