I have a string like this, where each word is marked with encoding (FW
, PRP
, etc) using underline:
Hi_FW !_.
My_PRP$ name_NN 's_POS Jim_NNP ._.
I_PRP 'm_VBP from_IN New_NNP Zealand_NNP ._.
This_DT is_VBZ my_PRP$ friend_NN ._.
His_PRP$ name_NN 's_POS Adam_NNP ._.
He_PRP 's_VBZ from_IN Australia_NNP ._.
This_DT is_VBZ my_PRP$ friend_NN too_RB ._.
Her_PRP$ name_NN 's_POS Paola_NNP ._.
She_PRP 's_VBZ from_IN Italy_NNP ._.
I need to break it into an array where a key is a word, and its value is its corresponding tag:
[
"Hi" => "FW",
"My" => "PRP$",
"name" => "NN"
...
]
I assume I can somehow split this string by the delimiter _
, but can't seem to find a good way to then join it into the array I need.
How can that be achieved?