示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#7
0
def find_received(soup):
    start = find_reg_el(soup, received_reg)
    return [re.sub(reg, '', start.text)]
示例#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))
示例#9
0
def find_plea(soup):
    reg = plea_reg
    start = find_reg_el(soup, reg)
    return [re.sub(reg, '', start.text)]
示例#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]
示例#11
0
def find_court(soup):
    return [find_reg_el(soup, court_reg).text]
示例#12
0
def find_received(soup):
    start = find_reg_el(soup, received_reg)
    return [re.sub(reg, '', start.text)]
示例#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))
示例#14
0
def find_plea(soup):
    reg = plea_reg
    start = find_reg_el(soup, reg)
    return [re.sub(reg, '', start.text)]
示例#15
0
def find_court(soup):
    return [find_reg_el(soup, court_reg).text]
示例#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
示例#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]
示例#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