From 217bb3d3f8016166b196b9c46431230faa2e2de7 Mon Sep 17 00:00:00 2001 From: jeremy rutman Date: Thu, 8 Sep 2022 18:54:07 -0500 Subject: [PATCH] Add files via upload --- code/__init__ | 0 code/codes.py | 38 ++++++++++++++++++++++++++++++++++++++ code/geek_decode.py | 17 +++++++++++++++++ code/test.py | 4 ++++ 4 files changed, 59 insertions(+) create mode 100644 code/__init__ create mode 100644 code/codes.py create mode 100644 code/geek_decode.py create mode 100644 code/test.py diff --git a/code/__init__ b/code/__init__ new file mode 100644 index 0000000..e69de29 diff --git a/code/codes.py b/code/codes.py new file mode 100644 index 0000000..94765f7 --- /dev/null +++ b/code/codes.py @@ -0,0 +1,38 @@ +# geek_code 5.x decoder + +geek_of = { +'GAI' : 'Geek of Artificial Intelligence', +'GBIO' : 'Geek of Biomedical Engineering', +'GB' : 'Geek of Business', +'GC' : 'Geek of Classics', +'GCA' : 'Geek of Commercial Arts', +'GCM' : 'Geek of Computer Management', +'GCS' : 'Geek of Computer Science', +'GCC' : 'Geek of Communications', +'GDS' : 'Geek of Data Science', +'GDVO' : 'Geek of DevOps', +'GE' : 'Geek of Engineering', +'GED' : 'Geek of Education', +'GFA' : 'Geek of Fine Arts', +'GFS' : 'Geek of Forensic Science', +'GG' : 'Geek of Government', +'GH' : 'Geek of Humanities', +'GIT' : 'Geek of Information Technology', +'GJ' : 'Geek of Jurisprudence (Law)', +'GLS' : 'Geek of Library Science', +'GL' : 'Geek of Literature', +'GMC' : 'Geek of Mass Communications', +'GM' : 'Geek of Math', +'GMD' : 'Geek of Medicine', +'GMU' : 'Geek of Music', +'GPA' : 'Geek of Performing Arts', +'GP' : 'Geek of Philosophy', +'GS' : 'Geek of Science (Physics, Chemistry, Biology, etc.)', +'GSS' : 'Geek of Social Science (Psychology, Sociology, etc.)', +'GTW' : 'Geek of Technical Writing', +'GVDD' : 'Geek of Video Game Design', +'GO' : 'Geek of Other. Some types of geeks deviate from the normal geek activities. This is encouraged as true geeks come from all walks of life.', +'GU' : 'Geek of "Undecided". This is a popular vocation with incoming freshmen.', +'G!' : 'Geek of no qualifications nor interests; likely, cannot exist', +'GAT' : 'Geek of All Trades. For those geeks that can do anything and everything. GAT usually precludes the use of other vocational descriptors.' +} diff --git a/code/geek_decode.py b/code/geek_decode.py new file mode 100644 index 0000000..32db1c3 --- /dev/null +++ b/code/geek_decode.py @@ -0,0 +1,17 @@ +# geek_code 5.x decoder + +import re +from codes import * + +def parse_geekcode(s): + full_meaning = [] + remaining_string = s + for d in [geek_of]: + for code,meaning in d.items(): + search_string = r'\b' + code + r'\b' + m = re.search(search_string,s) + if m: + print(f'found {search_string} in {remaining_string}') + remaining_string = re.sub(search_string, '', remaining_string) + full_meaning.append(meaning) + return(full_meaning, remaining_string) diff --git a/code/test.py b/code/test.py new file mode 100644 index 0000000..b52cbd6 --- /dev/null +++ b/code/test.py @@ -0,0 +1,4 @@ +import geek_decode + +meaning,remaining = geek_decode.parse_geekcode(' GS blabla GDS') +print(meaning, remaining)