def __init__(self, text: str, span: Tuple[int, int] = None, doc_idx: int = 0, score: float = 1.0):
"""
Create a new answer.
Args:
text: The text string of the answer.
span: For extractive QA, a span in the support documents. The triple `(start, end)`
represents a span in support document with index `doc_index` in the ordered sequence of
doc_idx: index of document where answer was found
support documents. The span starts at `start` and ends at `end` (exclusive).
score: the score a model associates with this answer.
"""
assert span is None or len(span) == 2, "span should be (char_start, char_end) tuple"
self.score = score
self.span = span
self.doc_idx = doc_idx
self.text = text
评论列表
文章目录