def get_text(node, strategy):
    """
    Get the most confident text results, either those with @index = 1 or the first text results or empty string.
    """
    textEquivs = node.get_TextEquiv()
    if not textEquivs:
        log.debug("No text results on %s %s", node, node.id)
        return ''
    #  elif strategy == 'index1':
    else:
        if len(textEquivs) > 1:
            index1 = [x for x in textEquivs if x.index == 1]
            if index1:
                return index1[0].get_Unicode().strip()
        return textEquivs[0].get_Unicode().strip()
def get_text ( node , strategy ) : textEquivs = node . get_TextEquiv ( ) if not textEquivs : log . debug ( "No text results on %s %s" , node , node . id ) return '' else : if len ( textEquivs ) > 1 : index1 = [ x for x in textEquivs if x . index == 1 ] if index1 : return index1 [ 0 ] . get_Unicode ( ) . strip ( ) return textEquivs [ 0 ] . get_Unicode ( ) . strip ( )
Get the most confident text results, either those with @index = 1 or the first text results or empty string.