Add files via upload

This commit is contained in:
jeremy rutman 2022-09-08 12:26:53 -05:00 committed by GitHub
parent 1d61c70086
commit d374d1d242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 0 deletions

38
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
geek_decode.py Normal file
View File

@ -0,0 +1,17 @@
# geek_code 5.x decoder
import re
import codes
def parse_geekcode(s):
full_meaning = []
remaining_string = s
for d in [codes.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'looking for {search_string} in {remaining_string}')
remaining_string = re.sub(search_string, '', remaining_string)
full_meaning.append(meaning)
return(full_meaning, remaining_string)

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