def map_tags(segmented_target, original_tags, segmentation_suffix=u'@@'):
    """
    Maps tags from the original segmentation into a new tag sequence, performing two operations:
    (1) append the corresponding target word to the tag
    (2) if the original corresponding word was segmented, duplicate the tag

    Params:
      segmented_target: a string where some tokens may end with `segmentation_suffix`
      original_tags: the tags corresponding to the target sequence before segmentation
      segmentation_suffix: the suffix used to indicate that a tag was segmented

    Returns:
      the mapped tag sequence
    """

    # assume whitespace tokenization
    if type(segmented_target) is not list:
        segmented_target = segmented_target.split()
    if type(original_tags) is not list:
        original_tags = original_tags.split()

    mapped_tags = []
    tag_idx = 0
    for trg_word in segmented_target:
        mapped_tag = u'{}-{}'.format(trg_word, original_tags[tag_idx])
        mapped_tags.append(mapped_tag)
        if not trg_word.endswith(segmentation_suffix):
            tag_idx += 1

    assert tag_idx == len(original_tags), 'We must cover all of the original tags'
    assert len(mapped_tags) == len(segmented_target), 'We must have a tag for every word'
    return mapped_tags