An example of somewhat used as a pronoun is in the sentence, "The room was somewhat of a mess," which means that the room was a little messy.
The crowd was somewhat larger than expected, perhaps due to the good weather. The decision to shave or not is a somewhat personal one.
An example of somewhat used as an adverb is in the sentence, "He is somewhat hungry," which means that he is not starving, but he is not full either.
Somewhat of a surprise.
The news was somewhat of a surprise.