Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextLoadUnify buggy without "--unify" #115

Open
phikoehn opened this issue Dec 20, 2019 · 0 comments
Open

TextLoadUnify buggy without "--unify" #115

phikoehn opened this issue Dec 20, 2019 · 0 comments

Comments

@phikoehn
Copy link

When not using the "--unify" option, there still will be an index of unique items built in TextLoadUnify that is based on unique lines. This messes up (at least) the "--score" option of scoring sentence pairs.

So, this:

for line in fin:
    new_ind = len(sent2ind)
    inds.append(sent2ind.setdefault(line, new_ind))
    if args.unify:
        if inds[-1] == new_ind:
            sents.append(line[:-1])
            nu += 1
    else:
        sents.append(line[:-1])
        nu += 1

should be changed to:

for line in fin:
    if args.unify:
        new_ind = len(sent2ind)
        inds.append(sent2ind.setdefault(line, new_ind))
        if inds[-1] == new_ind:
            sents.append(line[:-1])
            nu += 1
    else:
        sents.append(line[:-1])
        inds.append( nu )
        nu += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant