My friend Pugs has suggested a couple things to try, plus we will suggest other things, in order to give feedback and respond please join the site so you can reply in this thread. See this link for instructions on how to join Android Central.
Welcome to Android Central! It would help to know which Samsung phone you have. If a battery pull and system cache partition wipe don't help, then you could try connecting a basic USB keyboard via an OTG adapter (very inexpensive) to get you past the lockscreen, after which you can go to the Play Store and install another keyboard app.