(string, is_target=False)
| 32 | |
| 33 | |
| 34 | def cnndm_detokenize(string, is_target=False): |
| 35 | _tok_dict = {"(": "-LRB-", ")": "-RRB-", |
| 36 | "[": "-LSB-", "]": "-RSB-", |
| 37 | "{": "-LCB-", "}": "-RCB-"} |
| 38 | if not is_target: |
| 39 | string = string.replace("<S_SEP>", "") |
| 40 | else: |
| 41 | string = string.replace("<S_SEP>", "[SEP]") |
| 42 | for key, value in _tok_dict.items(): |
| 43 | string = string.replace(value, key) |
| 44 | string = string.replace("''", "\"") |
| 45 | string = string.replace("``", "\"") |
| 46 | string = string.replace("`", "'") |
| 47 | string = string.replace(" n't", "n't") |
| 48 | string = string.replace(" 's", "'s") |
| 49 | string = string.replace(" 'd", "'d") |
| 50 | string = string.replace(" 'll", "'ll") |
| 51 | return string |
| 52 | |
| 53 | |
| 54 | def blanklm_detokenize(string, is_target=False): |
nothing calls this directly
no outgoing calls
no test coverage detected