def getmorphology(word, tagmap):
    """Get morphological features FEATS for a given word."""
    if tagmap and word.tag_ in tagmap:
        # NB: replace '|' to fix invalid value 'PronType=int|rel' in which
        # 'rel' is not in the required 'attribute=value' format for FEATS.
        # val may be an int: Person=3
        feats = ['%s=%s' % (prop, str(val).replace('|', '/'))
                for prop, val in tagmap[word.tag_].items()
                if isinstance(prop, str)]
        if feats:
            return '|'.join(feats)
    return '_'