def _get_rhs_positions(document): matches = _get_matches(document) document_text = shared.get_text(document) stripper = lambda (start, end): \ shared.strip_segment_from_whitespace_and_newlines(document_text, start, end) return map(stripper, (match.span('rhs') for match in matches))
def _get_argument_positions(document, limit_to_keywords=False, truncate=None): argument_batch_positions = _get_argument_batch_positions(document, truncate=truncate) document_text = shared.get_text(document) raw_argument_positions = tuple(itertools.chain( *(_argpos( document_text[argument_batch_position[0]: argument_batch_position[1]], document_offset=argument_batch_position[0], limit_to_keywords=limit_to_keywords ) for argument_batch_position in argument_batch_positions) )) argument_positions = map( lambda (start, end): shared.strip_segment_from_whitespace_and_newlines(document_text, start, end), raw_argument_positions ) return argument_positions