Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBinder committed Jun 25, 2024
1 parent 7a2260d commit 35bb073
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/pie_modules/taskmodules/re_span_pair_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ def construct_argument_marker(pos: str, label: Optional[str] = None, role: str =
def inject_markers_into_text(
text: str, positions_and_markers: List[Tuple[int, str]]
) -> Tuple[str, Dict[int, Tuple[int, List[str]]]]:
"""Inject markers into the text at the given positions.
Args:
text: The text to inject the markers into.
positions_and_markers: A list of tuples where each tuple contains the position in the text
where the marker should be injected and the marker text itself.
Returns:
A tuple containing the text with the markers injected and a dictionary mapping the original
positions to the new positions and the markers that were injected at that position.
"""
offset = 0
original2new_pos: Dict[int, Tuple[int, List[str]]] = dict()
for original_pos, marker in sorted(positions_and_markers):
Expand Down

0 comments on commit 35bb073

Please sign in to comment.