wireless911 / span-aste

a sample pytorch Implementation of ACL 2021 research paper "Learning Span-Level Interactions for Aspect Sentiment Triplet Extraction".
Apache License 2.0
38 stars 2 forks source link

[BUG]span_index不一致的问题 #16

Open micrazy opened 1 year ago

micrazy commented 1 year ago

您好!您在处理数组下标的时候存在不一致的问题: 假设单字符作为aspect或opnion processor.py 这里通过a2 + 1,实际上的a_end_idx=a_start_idx+1,但 https://github.com/wireless911/span-aste/blob/e158fea27c0926944bf029eefa50b569eb9658f9/models/model.py#L60C3-L60C3 这里的逻辑里单字符的a_end_idx和 a_start_idx是相等的 @wireless911 @ZhihengHao 但似乎对训练不会造成大的影响,只是构造出来的window=1的span是无效的

wireless911 commented 1 year ago

processor.py 这里a2 + 1是为了获取到当前token a_start_idx, a_end_idx = self.fetch_offset(" ".join(tokens[:a1]), " ".join(tokens[a1:a2 + 1]))

你可以调试看下window=1时的start_idx 和 end_idx

micrazy commented 1 year ago

感谢作者回复~ 我理解这个操作是为了获取当前token的范围 [a_start_idx,a_end_idx),但是在https://github.com/wireless911/span-aste/blob/e158fea27c0926944bf029eefa50b569eb9658f9/models/model.py#L60C3-L60C3 这里,window=1时生成的候选span indice就无用了,因为不可能会有(a_start_idx,a_start_idx)这样的golden span