move tokenization implementation from rank\*.py to query.py