Please explain how to know the meaning of this sentence:
Amy saw her brother walking on the street.
Does that mean:
- (1) Amy was walking on the street and saw her brother.
- (2) Her brother was walking on the street and Amy saw him.
There is a classic example of this kind of ambiguous sentence, used for humorous effect:
One morning I shot an elephant in my pajamas. How he got in my pajamas I'll never know. - Groucho Marx, "Duck Soup" (1933)
The truth is, we don't know who was walking down the street. The sentence could be phrased the same with either meaning. However most listeners would assume it's the brother who was walking on the street, and not Amy. If Amy, then it would have been better phrased as:
While walking on the street, Amy saw her brother.
Of course in Groucho Marx's quote, no one would expect it to be the elephant wearing the pajamas, so it's funny when the meaning is resolved as the opposite.
It's also possible that they were both walking down the street:
(3) As Amy walked down the street, she saw her brother who was also walking down the street.
(I'm using down rather than on only because it's more common.)
You're right that, theoretically, the sentence is ambiguous—especially without any more context. However, most people would interpret it as (2).
That would be the typical interpretation for a couple of reasons.
First, because it would be very awkward for on the street to complement Amy. (In contrast, if it were while walking on the street, the complement would have to be Amy—and would be so naturally—because while couldn't complement her brother.)
Second, simply because walking on the street is closer to her brother than to Amy, and there's a natural assumption that things go with what they're closest to (even if that's not always the case).