コード例 #1
0
def _filter(file_path):
    index = Index()

    for notation, data in parse(file_path):
        if not notation.has_key():
            text = USE_CODE.findall(data['desc'])

            if text:
                match = ''.join(text[0].split())
                match = SCHEME.findall(match)

                if match and is_valid(Notation(match[0])):
                    valid_notation = Notation(match[0])

                    if valid_notation.has_text():
                        new_value = get_bracketed(text[0])
                        old_value = get_bracketed(valid_notation)

                        valid_notation = valid_notation.\
                            replace(old_value[0], new_value[0])

                    data['valid'] = valid_notation
                    index.add(notation, data, select=True)
                    continue

            index.add(notation, data, select=False)

    return index
コード例 #2
0
def data():
    index = Index()

    for key, value in NOTATIONS.items():
        index.add(key, value)

    return index
コード例 #3
0
def _filter(file_path):
    index = Index()

    for notation, data in parse(file_path):
        if not (notation.has_key() or notation.has_digit()):
            if notation.has_text() and not notation.has_name():
                parent = notation.get_parent()
                index.add(parent, dict(), select=True)

            index.add(notation, data, select=False)

    return index
コード例 #4
0
def _filter(file_path):
    index = Index()

    for notation, data in parse(file_path):
        if not (notation.has_text() or notation.has_key()):
            if notation.depth > 1 and notation.code[-1] == '9' \
                    and not data['desc'].startswith('other'):
                index.add(notation, data, select=True)

        index.add(notation, data, select=False)

    return index
コード例 #5
0
def _filter(file_path):
    index, terms = Index(), ['allegori', 'symboli']

    for notation, data in parse(file_path):
        if notation.depth > 1:
            if is_in(terms, data['desc'].lower()) or \
                    notation.code[-1] == '0':
                index.add(notation, data, select=True)
                continue

        index.add(notation, data, select=False)

    return index
コード例 #6
0
def _filter(file_path):
    index = Index()

    for notation, data in parse(file_path):
        if not (notation.has_key() or notation.has_text()):
            data['names'] = get_names(data, keep_all=False)

            if data['names'] and notation.depth > 3:
                parent = notation.get_parent()
                index.add(parent, dict(), select=True)

            index.add(notation, data, select=False)

    return index
コード例 #7
0
def _filter(file_path):
    index = Index()

    for notation, data in parse(file_path):
        if not (notation.has_key() or notation.has_name()):
            if notation.depth > 2:
                data['desc'] = data['desc'].lower()

                if len(notation.get_letter()) == 2:
                    index.add(notation, data, select=True)
                    continue

        index.add(notation, data, select=False)

    return index
コード例 #8
0
def _filter(file_path):
    index = Index()

    for notation, data in parse(file_path):
        if notation.division != 3 and not notation.has_key():
            data['names'] = get_names(data, keep_all=False)

            if not (notation.has_text() or notation.depth > 7 or
                    data['desc'].startswith(('other', 'early'))):
                gender = Genderize(data['desc']).code

                if gender:
                    data['gender'] = Notation(gender)
                    index.add(notation, data, select=True)
                    continue

            index.add(notation, data, select=False)

    return index