Helper function for merge. Takes a dictionary whose values are lists and returns a dict with the elements of each list as keys and the original keys as values.
(self, data)
| 208 | return self |
| 209 | |
| 210 | def __dict_invert(self, data): |
| 211 | """Helper function for merge. |
| 212 | |
| 213 | Takes a dictionary whose values are lists and returns a dict with |
| 214 | the elements of each list as keys and the original keys as values. |
| 215 | """ |
| 216 | outdict = {} |
| 217 | for k,lst in data.items(): |
| 218 | if isinstance(lst, str): |
| 219 | lst = lst.split() |
| 220 | for entry in lst: |
| 221 | outdict[entry] = k |
| 222 | return outdict |
| 223 | |
| 224 | def dict(self): |
| 225 | return self |