def genericProduce(t, nodeToID, rule, suffix=''):
    """
        Produce an element of a triple.
        The rule is a string in {'a','?A','c','?C'}
    """
    if suffix != '':
        suffix = ' %s' % suffix
    if rule == 'a':
        return '%s%s' % (t.parent.getWords(), suffix)
    if rule == '?A':
        return nodeToID[t.parent]
    if rule == 'c':
        return '%s%s' % (t.getWords(), suffix)
    if rule == '?C':
        return nodeToID[t]
