You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if par_eda == 1: # use eda to operate sentences when par_eda is true
for i in range(len(dat_plus['title_text'])):
if i%6 == 1:
dat_plus['title_text'][i] = copy.deepcopy(eda_text(dat_plus['title_text'][i]))
dat_plus['title_text'][i] = "".join(dat_plus['title_text'][i])
TypeError Traceback (most recent call last)
in
2 for i in range(len(dat_plus['title_text'])):
3 if i%6 == 1:
----> 4 dat_plus['title_text'][i] = copy.deepcopy(eda_text(dat_plus['title_text'][i]))
5 dat_plus['title_text'][i] = "".join(dat_plus['title_text'][i])
in eda_text(text)
23 if len(zz) <= 500:
24 #print(len(zz))
---> 25 tmp_text = aug_text(tmp_text)
26 # conbine prior 3 sentences and rest sentences
27 for j in range(len(text)-3):
in aug_text(text)
1 def aug_text(text):
----> 2 text = aug.augment(text)
3 return(text)
/home/user5/Desktop/BERT-FAKE-OR-TRUE/nlpaug/flow/sequential.py in augment(self, data)
36 augmented_data = data[:]
37 for aug in self:
---> 38 augmented_data = aug.augment(augmented_data)
39
40 results.append(augmented_data)
if par_eda == 1: # use eda to operate sentences when par_eda is true
for i in range(len(dat_plus['title_text'])):
if i%6 == 1:
dat_plus['title_text'][i] = copy.deepcopy(eda_text(dat_plus['title_text'][i]))
dat_plus['title_text'][i] = "".join(dat_plus['title_text'][i])
TypeError Traceback (most recent call last)
in
2 for i in range(len(dat_plus['title_text'])):
3 if i%6 == 1:
----> 4 dat_plus['title_text'][i] = copy.deepcopy(eda_text(dat_plus['title_text'][i]))
5 dat_plus['title_text'][i] = "".join(dat_plus['title_text'][i])
in eda_text(text)
23 if len(zz) <= 500:
24 #print(len(zz))
---> 25 tmp_text = aug_text(tmp_text)
26 # conbine prior 3 sentences and rest sentences
27 for j in range(len(text)-3):
in aug_text(text)
1 def aug_text(text):
----> 2 text = aug.augment(text)
3 return(text)
/home/user5/Desktop/BERT-FAKE-OR-TRUE/nlpaug/flow/sequential.py in augment(self, data)
36 augmented_data = data[:]
37 for aug in self:
---> 38 augmented_data = aug.augment(augmented_data)
39
40 results.append(augmented_data)
/home/user5/Desktop/BERT-FAKE-OR-TRUE/nlpaug/base_augmenter.py in augment(self, data)
71 return self.insert(data)
72 elif self.action == Action.SUBSTITUTE:
---> 73 return self.substitute(data)
74 elif self.action == Action.SWAP:
75 return self.swap(data)
/home/user5/Desktop/BERT-FAKE-OR-TRUE/nlpaug/augmenter/word/bert.py in substitute(self, data)
98 for aug_idx in aug_idxes[:1]:
99 original_word = results[aug_idx]
--> 100 candidate_words = self.model.predict(results, original_word, top_n=self.aug_n)
101 substitute_word = self.sample(candidate_words, 1)[0]
102
/home/user5/Desktop/BERT-FAKE-OR-TRUE/nlpaug/model/lang_models/bert.py in predict(self, input_tokens, target_word, top_n)
44 top_score_idx = target_idx
45 for _ in range(100):
---> 46 predictions[0, target_pos, top_score_idx] = -9999
47 top_score_idx = torch.argmax(predictions[0, target_pos]).item()
48 top_score_token = self.tokenizer.convert_ids_to_tokens([top_score_idx])[0]
TypeError: 'tuple' object does not support item assignmen
The text was updated successfully, but these errors were encountered: