Update README.md
Browse files
README.md
CHANGED
|
@@ -120,21 +120,17 @@ def special_encode(input, tokenizer):
|
|
| 120 |
|
| 121 |
return res_id
|
| 122 |
|
| 123 |
-
def
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
res_id += elem_id
|
| 134 |
-
if elem_idx < len(arr) - 1:
|
| 135 |
-
res_id.append(sep_id)
|
| 136 |
|
| 137 |
-
return res_id
|
| 138 |
|
| 139 |
if __name__ == '__main__':
|
| 140 |
text = "ε°ηθ¦ε°150εε
ε«θ―ι20%ηεθ―η¨ιζε«θ―ι5%ηθ―ζ°΄οΌιθ¦ε ζ°΄ε€ε°εε
οΌ"
|
|
|
|
| 120 |
|
| 121 |
return res_id
|
| 122 |
|
| 123 |
+
def extract_res(response):
|
| 124 |
+
if "[BOT]" in response:
|
| 125 |
+
response = response.split("[BOT]")[1]
|
| 126 |
+
if "<s>" in response:
|
| 127 |
+
response = response.split("<s>")[-1]
|
| 128 |
+
if "</s>" in response:
|
| 129 |
+
response = response.split("</s>")[0]
|
| 130 |
+
if "[SEP]" in response:
|
| 131 |
+
response = response.split("[SEP]")[0]
|
| 132 |
+
return response
|
|
|
|
|
|
|
|
|
|
| 133 |
|
|
|
|
| 134 |
|
| 135 |
if __name__ == '__main__':
|
| 136 |
text = "ε°ηθ¦ε°150εε
ε«θ―ι20%ηεθ―η¨ιζε«θ―ι5%ηθ―ζ°΄οΌιθ¦ε ζ°΄ε€ε°εε
οΌ"
|