4 of 4 added 349 characters in body

Haskell, 96 bytes

n"n"=15;n"="=14;n" "=2;n";"=13;n"\\"=3;n"\""=25;n"0"=2;n"1"=4;n"2"=4;n"3"=4;n"4"=5;n"5"=5;n n3=0

Try it online!

Haskell, 109 bytes

n 'n'=15;n '='=14;n ' '=14;n ';'=13;n '\\'=3;n '\''=25;n '0'=2;n '1'=5;n '2'=4;n '3'=4;n '4'=5;n '5'=5;n n3=0

Try it online!

Haskell, 122 bytes

n 'n'=21
n '='=14
n ' '=14
n '\n'=12
n '\\'=4
n '\''=32
n '0'=2
n '1'=5
n '2'=5
n '3'=3
n '4'=5
n '5'=5
n nnnnnn4'''''''=0

Try it online!

Explanations

These answers are not terribly sophisticated. It is a series of declarations, one for each character present in the program. At the end we have a catch all that returns 0 for characters not present in the program.

I use a couple of tricks to minimize the number of characters necessary in the program and from there I fiddled with things until the numbers turned out just right. You can see that I've padded the variable name in the last declaration, in all 3 of them. The difference between the 3 programs is whether I chose to use a new line or ; for line breaks and whether I chose to take Chars as input or Strings. The ; approach doesn't seem inherently superior to the others it just gets luck and ends up shorter, however it does seem that using Strings is a better idea than Chars because Chars require spaces after the function name an Strings do not.