Saturday, November 28, 2020

Visualizing Decision tree in Python (with codes included)

List of libraries required to be installed (if not already installed). Here installation is done through Jupyter Notebook. For terminal use only "pip install library-name".#import sys#!{sys.executable} -m pip install numpy#!{sys.executable} -m pip install pandas#!{sys.executable} -m pip install sklearn#!{sys.executable} -m pip install hvplot#!{sys.executable} -m pip install...

Tuesday, November 10, 2020

Python code to extract Temporal Expression from a text (Using Regular Expression)

#Method 1Code:import reprint('Enter the text:')text = input()months='(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|(Nov|Dec)(?:ember)?)'re1=r'\w?((mor|eve)(?:ning)|after(?:noon)?|(mid)?night|today|tomorrow|(yester|every)(?:day))' re2=r'\d?\w*(ago|after|before|now)'re3=r'((\d{1,2}(st|nd|rd|th)\s?)?(%s\s?)(\d{1,2})?)' % monthsre4=r'\d{1,2}\s?[a|p]m're5=r'(\d{1,2}(:\d{2})?\s?((hour|minute|second|hr|min|sec)(?:s)?))'re6=r'(\d{1,2}/\d{1,2}/\d{4})|(\d{4}/\d{1,2}/\d{1,2})'re7=r'(([0-1]?[0-9]|2[0-3]):[0-5][0-9])'re8=r'\d{4}'relist=...

Python code to extract temporal expression from the text using Regular E...

...