mkDict :: [(Ne, Type)] -> M.Map Ne [Type]
mkDict xs
    = fmap S.toList
    $ fromListWith S.union
    $ concatMap process xs
  where
    -- | Key k can be a multiword NE.
    process (k, x) =
        [(k, label) | k <- ks]
      where
        ks = T.words k
        label = S.singleton $ if length ks == 1
            then "e-" `T.append` x
            else "p-" `T.append` x
mkDict :: [(Ne, Type)] -> M.Map Ne [Type]
mkDict xs
    = fmap S.toList
    $ fromListWith S.union
    $ concatMap process xs
  where
    -- | Key k can be a multiword NE.
    process (k, x) =
        [(k, label) | k <- ks]
      where
        ks = T.words k
        label = S.singleton $ if length ks == 1
            then "e-" `T.append` x
            else "p-" `T.append` x
mkDict xs
    = fmap S.toList
    $ fromListWith S.union
    $ concatMap process xs
  where
    -- | Key k can be a multiword NE.
    process (k, x) =
        [(k, label) | k <- ks]
      where
        ks = T.words k
        label = S.singleton $ if length ks == 1
            then "e-" `T.append` x
            else "p-" `T.append` x