Skip to content

Removing hallucination in stopwords code incorrect #11

@TanmayParekh

Description

@TanmayParekh

According to the original paper, there's a boolean variable to remove stopwords from causing hallucination

Screenshot 2024-07-19 at 11 38 31 AM

But the code here does this correction inside the if 1 in thres statement. I suppose this should be outside this if statement

DRAGIN/src/generate.py

Lines 505 to 516 in a924d14

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions