3
$\begingroup$

I have some issues with the Lookup in Association. My association looks as:

asso = <|{"The", "food"} -> 1, {"food", "at"} -> 1, {"at", "snack"} ->
1, {"snack", "is"} -> 1, {"is", "a"} -> 1, {"a", "selection"} -> 
1, {"selection", "of"} -> 1, {"of", "popular"} -> 1, {"popular", "Greek"} -> 
1, {"Greek", "dishes"} -> 1, {"dishes", "The"} -> 1, {"The", "appetizer"} -> 
1, {"appetizer", "tray"} -> 1, {"tray", "is"} -> 1|>

I want to find the value of specific key in the asso

resKeys = Keys[asso]
resKeys[[1]]
Lookup[bigramUniqe, resKeys[[1]]]

But I get the next result:

{Missing["KeyAbsent", "The"], Missing["KeyAbsent", "food"]}
$\endgroup$
  • 4
    $\begingroup$ That's a specialty when using Lists or Integers as keys in an Association. In order to make it unambigous, one has to wrap with Key: like this: Lookup[asso, Key[resKeys[[1]]]]. $\endgroup$ – Henrik Schumacher Apr 29 '18 at 19:23
  • $\begingroup$ thanks a lot for your help to me today $\endgroup$ – Kiril Danilchenko Apr 29 '18 at 19:27
  • 2
    $\begingroup$ You're welcome. (Will be here also tomorrow ;) ) $\endgroup$ – Henrik Schumacher Apr 29 '18 at 19:28

Browse other questions tagged or ask your own question.