cloudroam
2025-04-15 acc5c1281b50c12e4d04c81b899410f6ca2cacac
check_labels.py
@@ -1,4 +1,5 @@
from ner_config import RepaymentNERConfig
from ner_config import RepaymentNERConfig, FlightNERConfig, TrainNERConfig
# 脚本:校验非法格式
@@ -6,14 +7,14 @@
    label_set = set()
    line_num = 0
    
    with open(RepaymentNERConfig.DATA_PATH, 'r', encoding='utf-8') as f:
    with open(FlightNERConfig.DATA_PATH, 'r', encoding='utf-8') as f:
        for line in f:
            line_num += 1
            line = line.strip()
            if line:
                try:
                    _, label = line.split(maxsplit=1)
                    if label not in RepaymentNERConfig.LABELS:
                    if label not in FlightNERConfig.LABELS:
                        print(f"行 {line_num}: 发现非法标签 '{label}'")
                        label_set.add(label)
                except Exception as e: