refactoring doc_tagger.py