Input: Sentence: 'A woman in a purple hat walking along a dirt field'. Count the number of nouns in this sentence.
Output: 4