It’s figurative language, specifically a metaphor. A metaphor is where an author says that something is something else, for example ‘she was a ray of sunshine’. Here, Hamlet is saying that Ophelia is a nymph. It’s a metaphor because Ophelia is not literally a nymph.
Francis Scott Key he got his inspiration when British warships sent shells and rockets to fort mc.henry and basically he saw everything was destroyed except the American flag