factorize Tpex class migrating loop and filter paramter into Tokenize
class