Overriding the encode and other functions in tokenizer

How to override the encode function in tokenizer and also the default decode function. It is not shown anywhere in the tutorials.
Can we declare a subclass and do it?
Thank you.