tokenize method from utils for document