<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import csv
from . import _chp_csv_path, _db_path
from .util import Directory

def build(chp_csv_path=None, db_path=None):

    if chp_csv_path is None:
        chp_csv_path = _chp_csv_path

    if db_path is None:
        db_path = _db_path

    dir_ = Directory(db_path)

    with open(chp_csv_path) as csv_f:
        dir_.load_chp_csv(csv_f)

def build_cmd(chp_csv_path=None, db_path=None):
    '''Build a ZIP code index by the CSV from Chunghwa Post.

    -i, --chp-csv-path  The path of the CSV.
    -o, --db-path       The output path.
    '''

    print 'Building ZIP code index ...',
    sys.stdout.flush()
    build(chp_csv_path, db_path)
    print 'Done.'

if __name__ == '__main__':

    try:
        import clime
    except ImportError:
        build(*sys.argv[1:])
    else:
        clime.start(white_pattern=clime.CMD_SUFFIX)
<commit_msg>It doesn't need csv.<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from . import _chp_csv_path, _db_path
from .util import Directory

def build(chp_csv_path=None, db_path=None):

    if chp_csv_path is None:
        chp_csv_path = _chp_csv_path

    if db_path is None:
        db_path = _db_path

    dir_ = Directory(db_path)

    with open(chp_csv_path) as csv_f:
        dir_.load_chp_csv(csv_f)

def build_cmd(chp_csv_path=None, db_path=None):
    '''Build a ZIP code index by the CSV from Chunghwa Post.

    -i, --chp-csv-path  The path of the CSV.
    -o, --db-path       The output path.
    '''

    print 'Building ZIP code index ...',
    sys.stdout.flush()
    build(chp_csv_path, db_path)
    print 'Done.'

if __name__ == '__main__':

    try:
        import clime
    except ImportError:
        build(*sys.argv[1:])
    else:
        clime.start(white_pattern=clime.CMD_SUFFIX)

{'fraction_non_alphanumeric': 0.11062906724511931, 'fraction_numerical': 0.0021691973969631237, 'mean_word_length': 2.62475442043222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5285078', 'n_tokens_mistral': 721, 'n_tokens_neox': 689, 'n_words': 171}