This commit is contained in:
exarobibliologist 2022-09-13 12:47:45 -04:00
commit fe7ed8cd4a
4 changed files with 59 additions and 0 deletions

0
code/__init__ Normal file
View File

38
code/codes.py Normal file
View File

@ -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.'
}

17
code/geek_decode.py Normal file
View File

@ -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)

4
code/test.py Normal file
View File

@ -0,0 +1,4 @@
import geek_decode
meaning,remaining = geek_decode.parse_geekcode(' GS blabla GDS')
print(meaning, remaining)