def find_judgment(soup): reg = judgment_reg start = find_reg_el(soup, reg) if start: results = [start] + find_until(start, re.compile('\w+:'), use_left=False) return [re.sub(reg, '', ' '.join(map(lambda x: x.text, results)))] else: return None
def find_judgment(soup): reg = judgment_reg start = find_reg_el(soup, reg) if start: results = [start] + find_until( start, re.compile('\w+:'), use_left=False) return [re.sub(reg, '', ' '.join(map(lambda x: x.text, results)))] else: return None
def find_solicitors(soup): reg = re.compile(r'^solicitors?(/counsel)?s?[:;]?\W*', flags=re.IGNORECASE) start = find_reg_el(soup, reg, field=["footer-field", "intituling-field"]) strings = [] if start: if re.sub(reg, '', start.text): strings += [re.sub(reg, '', start.text)] results = find_until(start, None, use_left=False) strings += map(lambda x: x.text, results) strings = filter(lambda x: not x.startswith('('), strings) strings = filter(lambda x: x, strings) return strings
def find_hearing(soup): reg = hearing_reg start = find_reg_el(soup, reg) if start: more_left = False use_left = True if re.sub(reg, '', start.text).strip(): use_left = False more_left = True else: start = start.next_sibling results = [start] + find_until(start, re.compile('\w+:'), use_left=use_left, more_left=more_left) return [re.sub(reg, '', ' '.join(map(lambda x: x.text, results)))] else: return None
def find_hearing(soup): reg = hearing_reg start = find_reg_el(soup, reg) if start: more_left = False use_left = True if re.sub(reg, '', start.text).strip(): use_left = False more_left = True else: start = start.next_sibling results = [start] + find_until( start, re.compile('\w+:'), use_left=use_left, more_left=more_left) return [re.sub(reg, '', ' '.join(map(lambda x: x.text, results)))] else: return None
def find_received(soup): start = find_reg_el(soup, received_reg) return [re.sub(reg, '', start.text)]
def find_counsel(soup): reg = counsel_reg start = find_reg_el(soup, reg) results = [start]+ find_until(start, re.compile('\w+:'), use_left=False) return filter(None, map(lambda x: re.sub(reg, '', x.text.strip()), results))
def find_plea(soup): reg = plea_reg start = find_reg_el(soup, reg) return [re.sub(reg, '', start.text)]
def find_registry(soup): start = find_reg_el(soup, court_reg) registry = find_until(start, None, use_left=True) if registry: return [registry[-1].text]
def find_court(soup): return [find_reg_el(soup, court_reg).text]
def find_counsel(soup): reg = counsel_reg start = find_reg_el(soup, reg) results = [start] + find_until(start, re.compile('\w+:'), use_left=False) return filter(None, map(lambda x: re.sub(reg, '', x.text.strip()), results))
def find_neutral(soup): reg = re.compile(r'\W*\[(\d){4}\] NZ(HC|CA|SC) (\d+)\W*$') try: return [find_reg_el(soup, reg).text.strip()] except AttributeError: return None