# Mapping AssociationThread over list with repeating keys [closed]

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"}



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.

• An association cannot have multiple instances of the same key. What you show as the desired output is not a valid association. – Szabolcs Jun 18 '16 at 21:09
• Try Merge[Identity]@Thread@Rule[wordType, words]. – Edmund Jun 18 '16 at 21:14
• @Edmund Brilliant! Many thanks. – Connor Jun 18 '16 at 21:52
• If you explain what you want to use this association for, people will be able to suggest working alternatives. One is Edmund's solution. Another is Thread[wordType -> words]. What's useful really depends on what you need this for. – Szabolcs Jun 18 '16 at 21:53
• This could likely be considered a duplicate of one of these: (60913), (4332), (61655) – Mr.Wizard Jun 19 '16 at 3:58

Merge[Identity]@Thread@Rule[wordType, words] Works Perfectly! (Edmund)