Question: Could anyone point me to direction how to use GPT-J model for text paraphrasing . As generating text is easy, but paraphrasing?
Do I need to fine tune on paraphrasing dataset? Or could I just use few shot training?

Answer: 
As already mentioned, you'd need to check the last condition first, as it's checking both the first and last letter. Note that you can keep the multiple `if` statements if you want, rather than switch to use `elif`, because the `return` statements break out of the function early in any case.

```py
def one_two(word):
    try:
        fw, *_, lw = word
    except ValueError:  # empty string, or string is too short
        if not word:
            return None
        fw, lw = word, word

    if (fw, lw) == ('o', 't'):
        return 'onetwo'
    if fw == 'o':
        return 'one'
    if lw == 't':
        return 'two'

assert (one_two("only") == "one")
assert (one_two("cart") == "two")
print(one_two("o+++t"))
assert (one_two("o+++t") == "onetwo")
# edge cases
assert one_two('') is None
assert one_two('o') == 'one'
assert one_two('t') == 'two'
assert one_two('ot') == 'onetwo'

```
```
def one_two(word):
    return {'o': 'one'}.get(word[0], '') + {'t': 'two'}.get(word[-1], '') if len(word) else ''

```