Fix splitter and add a unittest (#58075)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58075
Pull Request resolved: https://github.com/facebookresearch/pytext/pull/1687
Reviewed By: mikekgfb
Differential Revision: D28357724
fbshipit-source-id: 36c2d211576a90107bc75468a39408ffecaeed43