refactored PoS and NER tagging code