Improve split on token
Author: changjonathanc
Pull request: yes
Labels: name: wontfix

This patch makes the code shorter, also solves a bug that is suppressed already[1]

old code:
split_on_token(tok = '[MASK]', text='')
> ['[MASK]']

This is a bug, because split_on_token shouldn't add token when the input doesn't have the token

[1] 21451ec (handle string with only whitespaces as empty, 2019-12-06)


Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3981?src=pr&el=h1) Report
> Merging [#3981](https://codecov.io/gh/huggingface/transformers/pull/3981?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/4e817ff41885063e08bb3bcd63e5adfd835b9911&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/3981/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/3981?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #3981      +/-   ##
==========================================
- Coverage   78.44%   78.42%   -0.03%     
==========================================
  Files         111      111              
  Lines       18518    18513       -5     
==========================================
- Hits        14527    14518       -9     
- Misses       3991     3995       +4     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/3981?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/tokenization\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3981/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90b2tlbml6YXRpb25fdXRpbHMucHk=) | `89.78% <100.00%> (+0.05%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3981/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `91.94% <0.00%> (-0.83%)` | :arrow_down: |
| [src/transformers/file\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3981/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9maWxlX3V0aWxzLnB5) | `68.49% <0.00%> (-0.37%)` | :arrow_down: |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3981/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `91.06% <0.00%> (+0.12%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/3981?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3981?src=pr&el=footer). Last update [4e817ff...410c538](https://codecov.io/gh/huggingface/transformers/pull/3981?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.