def convert_parens_in_rst_tree_str(rst_tree_str):
    '''
    This converts '(' and ')' brackets the EDUs of the RST into PTB-style
    tokens (e.g., -LRB-) to escape them for nltk.
    '''
    def replace_brackets(matchobj):
        edu = matchobj.group(0)
        for (br, br_repl) in DIS_ESCAPES:
            edu = re.sub("\{}".format(br), br_repl, edu)
        return edu

    return re.sub('_!(.*?)_!', replace_brackets, rst_tree_str)
def convert_parens_in_rst_tree_str ( rst_tree_str ) : def replace_brackets ( matchobj ) : edu = matchobj . group ( 0 ) for ( br , br_repl ) in DIS_ESCAPES : edu = re . sub ( "\{}" . format ( br ) , br_repl , edu ) return edu return re . sub ( '_!(.*?)_!' , replace_brackets , rst_tree_str )
This converts '(' and ')' brackets the EDUs of the RST into PTB-style
    tokens (e.g., -LRB-) to escape them for nltk.