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

random.choice() on a sentence generates a character #3

Closed
BiophysNinja opened this issue Sep 12, 2022 · 3 comments
Closed

random.choice() on a sentence generates a character #3

BiophysNinja opened this issue Sep 12, 2022 · 3 comments

Comments

@BiophysNinja
Copy link

   for foil_id, foil in tqdm(foils_data.items()):
        caption_fits = foil['mturk']['caption']

        if caption_fits >= 2:  # valid examples only (validated by mturkers)

            test_img_path = os.path.join(images_path, foil["image_file"])

            if instrument == 'plurals':
                test_sentences = [foil["caption"][0], random.choice(foil["foils"])]
            else:
                test_sentences = [foil["caption"], random.choice(foil["foils"])]

why random.choice() used in here? that creates single character sentences

@BiophysNinja
Copy link
Author

BiophysNinja commented Sep 13, 2022

else:
    test_sentences = [foil["caption"], foil["foil"]]

"foils" needs to be changed to "foil" as well

@LetiP
Copy link
Member

LetiP commented Sep 13, 2022

Thanks a lot for pointing this out to us! Just pushed a fix to this.

I forgot I had cleaned up the data format before publishing and tested this script on the uncleaned version, where you can guess, the foil entry was foils consisting of a list of one element (which in turn is a reminiscence from those times where we had more than one foil per data sample, therefore the random.choice).

In any case, this should be fixed now, thanks for your help and please let us know if you encounter any further problems. 🤝

@LetiP LetiP closed this as completed Sep 13, 2022
@BiophysNinja
Copy link
Author

Thank you for the quick response and the excellent work :).

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

2 participants