Skip to content

Commit c1e3117

Browse files
committed
update paraphrasing code to fix an error
1 parent e840928 commit c1e3117

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

machine-learning/nlp/text-paraphrasing/Paraphrasing_with_Transformers_PythonCode.ipynb

+3-2
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,9 @@
644644
" print(\"Input_phrase: \", phrase)\n",
645645
" print(\"-\"*100)\n",
646646
" paraphrases = parrot.augment(input_phrase=phrase)\n",
647-
" for paraphrase in paraphrases:\n",
648-
" print(paraphrase)"
647+
" if paraphrases:\n",
648+
" for paraphrase in paraphrases:\n",
649+
" print(paraphrase)"
649650
]
650651
}
651652
],

machine-learning/nlp/text-paraphrasing/paraphrasing_with_transformers_pythoncode.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def get_paraphrased_sentences(model, tokenizer, sentence, num_return_sequences=5
6161
print("Input_phrase: ", phrase)
6262
print("-"*100)
6363
paraphrases = parrot.augment(input_phrase=phrase)
64-
for paraphrase in paraphrases:
65-
print(paraphrase)
64+
if paraphrases:
65+
for paraphrase in paraphrases:
66+
print(paraphrase)
6667

0 commit comments

Comments
 (0)