Read ASCII-Art Text
Python 2, 405 335 234 182 171 bytes
lambda s,j=''.join:j(' QPVXU_O__FBLK_JMD_CSYZWIENH_AG___TR'[int(j(`ord(y)%2`for y in j(s.split('\n')[x][i:i+5]for x in range(5))),2)%13836%37]for i in range(0,len(s)/5,6))
Try it online!
Finally shorter than JS
Jelly, 50 44 42 bytes
ỴZ;6/UOḂḅ7‘ị“¥ŒƲVĊ⁾|W£⁼³ƭÇuʋụzḢĖ0ḢẆẠØsĠỌỊ»
Try it online! (note the argument does not require the leading newline, but since leading and trailing newlines have no effect I included one to make the multiline string more human-readable)
Results are mixed case (as allowed by the OP in a comment).
How?
Splits on new lines, transposes, and joins together sub-slices of (up to) six together to get the character representations and reverses each (equating the later base conversion for the final character of length 25 to all the others of length 30). Then maps '#'
and ' '
to one and zero respectively using the fact that '#'
has an odd ordinal while ' '
has an even one. Reads each as if it were a base seven number. Effectively takes modulo 81 of each (to yield 27 unique values for the 27 possible cases), and finally indexes into a "magic string" with the correct chars at the correct indexes (modulo indexing is used with a magic string of length 81 to save 2 bytes).
Here is the "magic string" I created along with a (case-insensitive) regex pattern it needed to match (I added "ed" to make it length 81):
' affectedly Azerbaijan rewaxed naganas jiujitsudankly pase UVB freqHaarlemcoacted'
'^ ..f...e.....z......a..r.w.x...n.g......iuj....d..kly.p.s...vb....qh.....m.o.ct.*'
As such it may be compressed, looking up eleven sub-slices as words in Jelly's dictionary (most of which use the leading space default):
' affectedly Azerbaijan rewaxed naganas jiujitsudankly pase UVB freqHaarlemcoacted'
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
which results in the Jelly compressed string, “¥ŒƲVĊ⁾|W£⁼³ƭÇuʋụzḢĖ0ḢẆẠØsĠỌỊ»
The rest of the code works as follows:
ỴZ;6/UOḂḅ7‘ị“...» - Main link: multi-line string, s e.g. HI as the #s and spaces
Ỵ - split on new lines ["# # #####","# # # ","##### # ","# # # ","# # #####"] (each is actually a list)
Z - transpose ["#####"," # "," # "," # ","#####"," ","# #","# #","#####","# #","# #"] (each is actually a list)
6/ - six-wise reduce by
; - concatenation ["##### # # # ##### ","# ## ####### ## #"] (each is actually a list)
U - upend (reverse each) [" ##### # # # #####","# ## ####### ## #"] (each is actually a list)
- note: all except the last will be length 30 and like " ...", which will become [0,0,0,0,0,...], while the last will be length 25 without those five leading zeros.
O - cast to ordinals ('#' -> 35, ' '-> 32) [[32,32,...],[35,32,...]]
Ḃ - modulo 2 ('#' -> 1, ' ' -> 0) [000001111100100001000010011111, 1000110001111111000110001] (each is actually a list)
ḅ7 - convert from base 7 (vectorises) [223498370543967315553, 191672428080864454753] (these are now integers)
‘ - increment [223498370543967315554, 191672428080864454754]
- (modulo 81 these would be [68, 41])
ị - index into (modulo & 1-indexed):
“...» - the "magic string" described above ' affectedly Azerbaijan rewaxed naganas jiujitsudankly pase UVB freqHaarlemcoacted'
"Hi" 41^ 68^
JavaScript (ES6), 204 186 184 182 bytes
Saved 18 bytes thanks to Neil
Saved 2 bytes thanks to ETHproductions
Saved 2 bytes thanks to YairRand
Breakdown:
- 42-byte lookup table
162144142140 bytes of code
s=>(a=s.split`
`)[0].replace(/.{6}/g,(_,n)=>' H_JM__WDCSORLU___QKG_P_AFT_N_EI_XBV____YZ'[[0,1,2,4].reduce((p,r,i)=>p+='0b'+a[r].substr(n,5).replace(/./g,c=>1^1-c)<<i*6,0)%178%69%43])
Demo
let f =
s=>(a=s.split`
`)[0].replace(/.{6}/g,(_,n)=>' H_JM__WDCSORLU___QKG_P_AFT_N_EI_XBV____YZ'[[0,1,2,4].reduce((p,r,i)=>p+='0b'+a[r].substr(n,5).replace(/./g,c=>1^1-c)<<i*6,0)%178%69%43])
console.log(f(
' ### ### ### ##### ##### \n'+
'# # # # # # # \n'+
'##### ### # # # \n'+
'# # # # # # # \n'+
'# # ### ### ##### ##### \n'
));