import streamlit as st import re import datetime import copy # Absolute Date [or pieces of it] mdy_abs_1 = re.compile('[0-9]{1,2}[-\/.][0-9]{1,2}([-\/.][0-9]{4})?', re.IGNORECASE) #12-13-2023" mdy_abs_2 = re.compile('(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|january|february|march|april|may|june|july|august|sept|september|october|november|december)\.? ?[0-9]{1,2}(th|st|nd|rd)*,? ?([0-9]{4})?', re.IGNORECASE) # July 3 mdy_abs_3 = re.compile('[0-9]{1,2}(th|st|nd|rd)* ?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|january|february|march|april|may|june|july|august|sept|september|october|november|december),? ?([0-9]{4})?', re.IGNORECASE) m_abs_1 = re.compile('(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|january|february|march|april|may|june|july|august|sept|september|october|november|december)', re.IGNORECASE) # Just month d_abs_1 = re.compile('[0-9]{1,2}(th|st|nd|rd)*', re.IGNORECASE) # Just date # Relative Date mdy_rel_1 = re.compile('((monday|mon)|(tuesday|tue)|(wednesday|wed)|(thursday|thu)|(friday|fri)|(saturday|sat)|(sunday|sun))([^a-z]|)]', re.IGNORECASE) # Days of week. Fully resolves. mdy_rel_2 = re.compile('((tom)(orrow)?.?)|(today)|(tonight)|(now)|((week)(end)?)', re.IGNORECASE) # Tomorrow. Fully resolves del_days_rel_1 = re.compile('([0-9]|( |a|the|one|two|three|four|five|six|seven|eight|nine)) ?days? ?', re.IGNORECASE) # "X days". Fully resolves # Absolute Time hhmm_abs_1 = re.compile('[0-9]{1,2}:?([^-\/][0-9]{0,2})? ?(am|pm|a\.m\.|p\.m\.|a m|p m|a([^a-z]|)|p([^a-z]|))', re.IGNORECASE) hhmm_abs_2 = re.compile(' (noon|midnight)', re.IGNORECASE) # Relative Time del_hours_rel_1 = re.compile('([0-9]{1,2}|(|a|the|one|two|three|few|four|five|six|seven|eight|nine|ten)) ?((hour|hrs.?)|(min(ute)?))s?', re.IGNORECASE) adverbs = re.compile('(from|after|before|next|end|this|past) ', re.IGNORECASE) # Adverbs used to resolve if multiple patterns are "hit". This leads to the "addition" problem (described on notion). x = st.slider('Select a value') st.write(x, 'squared is', x * x)