According to the original paper, there's a boolean variable to remove stopwords from causing hallucination
But the code here does this correction inside the if 1 in thres statement. I suppose this should be outside this if statement
|
if "check_real_words" in self.__dict__ and self.check_real_words: |
|
doc = nlp(sent) |
|
real_words = set(token.text for token in doc if token.pos_ in |
|
['NOUN', 'ADJ', 'VERB', 'PROPN', 'NUM']) |
|
def match(tok): |
|
for word in real_words: |
|
if word in tok: |
|
return True |
|
return False |
|
for i in range(len(thres)): |
|
if not match(tokens[tl+i]): |
|
thres[i] = 0 |
According to the original paper, there's a boolean variable to remove stopwords from causing hallucination
But the code here does this correction inside the
if 1 in thresstatement. I suppose this should be outside thisifstatementDRAGIN/src/generate.py
Lines 505 to 516 in a924d14