Punishing her won't work. You know by now what her threshold is - what distance people are from her when she starts to bark. Just before that, start counter-conditioning her. That means distract her with really yummy treats (very tiny, bite-size treats) and talk to her. Teach her "no bark". She gets treats when she doesn't bark and when a person's approaching. You say "no bark" and good girl and keep feeding her.
If she barks, the treats disappear. It could be because she's young and being excitable and she needs to be trained that it's not acceptable, not punished.