scripts/compute_corrupt.py [112:131]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            words = response.split(" ")
            drop_word_pos = []
            for wi, word in enumerate(words):
                flip = random.uniform(0, 1)
                if flip <= args.drop_per and word not in ["[CLS]", "[SEP]"]:
                    drop_word_pos.append(wi)
            # import ipdb; ipdb.set_trace()
            response = [r for i, r in enumerate(words) if i not in drop_word_pos]
            if len(response) == 0:
                response = random.sample(words, len(words))
            if len(response) == 0:
                print("response zero")
            response = " ".join(response)
            if len(response.strip()) == 0:
                response = "word"
            row = {
                "dialog_id": row["dialog_id"],
                "context_id": row["context_id"],
                "context": row["context"],
                "context_hash": row["context_hash"] if "context_hash" in row else 1,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



scripts/compute_corrupt.py [152:171]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            words = response.split(" ")
            drop_word_pos = []
            for wi, word in enumerate(words):
                flip = random.uniform(0, 1)
                if flip <= args.drop_per and word not in ["[CLS]", "[SEP]"]:
                    drop_word_pos.append(wi)
            # import ipdb; ipdb.set_trace()
            response = [r for i, r in enumerate(words) if i not in drop_word_pos]
            if len(response) == 0:
                response = random.sample(words, len(words))
            if len(response) == 0:
                print("response zero")
            response = " ".join(response)
            if len(response.strip()) == 0:
                response = "word"
            row = {
                "dialog_id": row["dialog_id"],
                "context_id": row["context_id"],
                "context": row["context"],
                "context_hash": row["context_hash"] if "context_hash" in row else 1,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



