I have two lists. One with the same repeating four keys and the other with unique values. Both are the same length. I want to Associate the first list with the second list. So if that if the 5th element of the 1st and 2nd list respectively are "noun" and "house, then "house" would be added to the noun key.
wordType = {{"adjective"}, {"verb"}, {"noun"}, {"adverb"}, {"adjective"},{"verb"}}
words= {"pretty", "run", "house", "accordingly", "coarse", "catch"}
AssociationThread[wordType, words]
desired output:
<|{"adjective"} -> "pretty", {"verb"} -> "run", {"noun"} -> "house", {"adverb"} -> "accordingly",{"adjective"} -> "coarse",{"verb"} -> "catch"|>
actual output:
<|{"adjective"} -> "coarse", {"verb"} -> "catch", {"noun"} -> "house", {"adverb"} -> "accordingly"|>
you see the "one" key seems to be sloted. It was 1 at the begining but by the end had been replaced with 5. Same with the "two" key.
Merge[Identity]@Thread@Rule[wordType, words]. – Edmund Jun 18 '16 at 21:14Thread[wordType -> words]. What's useful really depends on what you need this for. – Szabolcs Jun 18 '16 at 21:53