-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
6.2.1 章,「スパンの重なる固有表現の存在を判定」において,誤植と思われる箇所があります.
出力結果は変わりませんが,正誤表に載っていないので報告します.
def has_overlap(
spans: list[tuple[int, int]],
) -> int:
sorted_spans = sorted(spans, key=lambda x: x[0])
for i in range(1, len(sorted_spans)):
if sorted_spans[i-1][1] > sorted_spans[i][0]:
return 1
return 0
overlap_count = 0
for split in dataset:
for data in dataset[split]:
if data["entities"]:
spans = [e["span"] for e in data["entities"]]
overlap_count += has_overlap(spans)
print(f"{split} におけるスパンが重複する事例数: {overlap_count}")このコードにおいて overlap_count = 0 が for split in dataset: の前に来ていますが,これは
for split in dataset:
overlap_count = 0ではないでしょうか?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels