#========================================================
patterns = [
#=========================adjectives=====================
(r'.*ful$', 'JJ'),
(r'.*ious$', 'JJ'),
(r'.*ble$', 'JJ'),
(r'.*ic$', 'JJ'),
(r'.*ive$', 'JJ'),
(r'.*ic$', 'JJ'),
(r'.*est$', 'JJ'),
#=========================article====================
.... some other patterns
#===========================Noun==========================
(r'.*\'s$', 'NN$'), # possessive nouns
(r'.*s$', 'NNS'), # plural nouns
(r'.*ation$', 'NN'),
(r'.*ism$', 'NN'), #capitalism
(r'.*ment$', 'NN'), #assignment
(r'.*ness$', 'NN'), #sadness
(r'.*ance$', 'NN'), #acceptance
(r'.*ful$', 'NN'), #greatful
#==========================================================
(r'^-?[0-9]+(.[0-9]+)?$', 'CD'), # cardinal numbers
(r'.*', 'NN') # nouns (default)
]
it works good, but my problem is setting pattern according to the previous word, for example: if the previous word is "AT" the next word will be "NN", could you please help me in this?