{
    "doc_type": "receipt",
    "label": "영수증",

    "preprocess": {
        "max_slope": 0.05,
        "y_tolerance": 5,
        "x_tolerance": 10,
        "remove_patterns": ["^\\s*$"],
        "merge_patterns": ["\\d{1,3}(,\\d{3})+원?"]
    },

    "keywords": {
        "store_name": ["상호", "가맹점", "점포명"],
        "corp_num": ["사업자번호", "사업자등록번호"],
        "date": ["거래일시", "승인일시", "일시", "날짜"],
        "total_amount": ["합계", "결제금액", "승인금액", "총금액", "금액"],
        "payment_type": ["결제수단", "결제방법"],
        "card_number": ["카드번호", "카드"]
    },

    "fields": {
        "store_name": {
            "output_key": "store_name",
            "criteria": [
                { "keyword": "상호", "direction": "RIGHT" },
                { "keyword": "가맹점", "direction": "RIGHT" },
                { "keyword": "점포명", "direction": "RIGHT" }
            ]
        },
        "corp_num": {
            "output_key": "corp_num",
            "criteria": [
                { "keyword": "사업자번호", "direction": "RIGHT" },
                { "keyword": "사업자등록번호", "direction": "RIGHT" }
            ],
            "refine": "biz_num"
        },
        "date": {
            "output_key": "date",
            "mode": "regex_scan",
            "pattern": "(\\d{4}[./-]\\d{2}[./-]\\d{2}(?:[\\s]\\d{2}:\\d{2}(?::\\d{2})?)?)",
            "capture_group": 1,
            "refine": "date"
        },
        "total_amount": {
            "output_key": "total_amount",
            "criteria": [
                { "keyword": "합계", "direction": "RIGHT" },
                { "keyword": "합계", "direction": "DOWN" },
                { "keyword": "결제금액", "direction": "RIGHT" },
                { "keyword": "승인금액", "direction": "RIGHT" }
            ],
            "refine": "number"
        },
        "payment_type": {
            "output_key": "payment_type",
            "criteria": [
                { "keyword": "결제수단", "direction": "RIGHT" },
                { "keyword": "결제방법", "direction": "RIGHT" }
            ]
        },
        "card_number": {
            "output_key": "card_number",
            "mode": "regex_scan",
            "pattern": "([0-9*]{4}[-\\s]?[0-9*]{4}[-\\s]?[0-9*]{4}[-\\s]?[0-9*]{4})",
            "capture_group": 1
        }
    },

    "required_fields": ["total_amount"],

    "confidence_weight": {
        "store_name": 0.2,
        "corp_num": 0.15,
        "date": 0.25,
        "total_amount": 0.4
    }
}
