def make_chains_with_names(sentences):
<EOL>fake_equiv_ids = -<NUM_LIT:2><EOL>equiv_ids = collections.defaultdict(lambda: (set(), set()))<EOL>for tagger_id, sents in list(sentences.items()):<EOL><INDENT>for sent in sents:<EOL><INDENT>for tok in sent.tokens:<EOL><INDENT>if tok.entity_type is not None:<EOL><INDENT>if tok.equiv_id == -<NUM_LIT:1>:<EOL><INDENT>eqid = fake_equiv_ids<EOL>fake_equiv_ids -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>eqid = tok.equiv_id<EOL><DEDENT>equiv_ids[eqid][<NUM_LIT:0>].add(cleanse(tok.token.decode('<STR_LIT:utf8>')))<EOL>equiv_ids[eqid][<NUM_LIT:1>].add(tok)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return equiv_ids<EOL>
assemble in-doc coref chains by mapping equiv_id to tokens and
their cleansed name strings

:param sentences: iterator over token generators
:returns dict:
    keys are equiv_ids,
    values are tuple(concatentated name string, list of tokens)