Example #1
0
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
Example #2
0
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
Example #3
0
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
Example #4
0
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
Example #5
0
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
Example #6
0
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
Example #7
0
def find_received(soup):
    start = find_reg_el(soup, received_reg)
    return [re.sub(reg, '', start.text)]
Example #8
0
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))
Example #9
0
def find_plea(soup):
    reg = plea_reg
    start = find_reg_el(soup, reg)
    return [re.sub(reg, '', start.text)]
Example #10
0
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]
Example #11
0
def find_court(soup):
    return [find_reg_el(soup, court_reg).text]
Example #12
0
def find_received(soup):
    start = find_reg_el(soup, received_reg)
    return [re.sub(reg, '', start.text)]
Example #13
0
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))
Example #14
0
def find_plea(soup):
    reg = plea_reg
    start = find_reg_el(soup, reg)
    return [re.sub(reg, '', start.text)]
Example #15
0
def find_court(soup):
    return [find_reg_el(soup, court_reg).text]
Example #16
0
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
Example #17
0
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]
Example #18
0
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