占比表与缺口清单按学院写法归一,0856覆盖41键升到51键
公示侧学院有三种写法:目录原名、带前导院码(290 材料科学与工程学院)、 只给院码(001)。原先只按原名比,后两种被误判成该学院没公示。 归一后 0856 推免合计930人里学院组可核881(95%)、仅同校同码49, 占比表新增可核列与可核方式,缺口清单覆盖 41→51 键、转缺 0。
This commit is contained in:
1 parent
0dc94d64ec
commit
e0fb8bda38
6 files changed
+1289
-1010
No files matched your search
+984
-984
File diff suppressed because it is too large.
Load diff
@@ -1,26 +1,26 @@
|
||||
院校,专业代码,专业名称,统考名额_不含推免,推免已接收,总规模,推免占比,学院组数,N口径
|
||||
东北大学,085601,材料工程,255,126,381,33%,1,专业级
|
||||
东北大学,085602,化学工程,35,6,41,15%,1,专业级
|
||||
东北大学,085603,冶金工程,184,60,244,25%,1,专业级
|
||||
东华大学,085600,材料与化工,404,56,460,12%,5,专业级+方向级SUM
|
||||
东南大学,085600,材料与化工,32,1,33,3%,1,方向级SUM
|
||||
东南大学,085601,材料工程,33,3,36,8%,1,专业级
|
||||
东南大学,085602,化学工程,49,11,60,18%,2,专业级
|
||||
中国矿业大学(北京),085601,材料工程,7,4,11,36%,1,方向级SUM
|
||||
中国矿业大学(北京),085602,化学工程,43,2,45,4%,1,方向级SUM
|
||||
中山大学,085600,材料与化工,57,25,82,30%,2,专业级
|
||||
中山大学,085601,材料工程,59,59,118,50%,2,专业级
|
||||
北京航空航天大学,085600,材料与化工,25,58,83,70%,3,方向级SUM
|
||||
北京航空航天大学,085601,材料工程,58,36,94,38%,1,专业级
|
||||
南京理工大学,085601,材料工程,144,36,180,20%,3,方向级SUM
|
||||
南京理工大学,085602,化学工程,96,25,121,21%,1,专业级
|
||||
合肥工业大学,085601,材料工程,85,48,133,36%,4,专业级
|
||||
合肥工业大学,085602,化学工程,28,19,47,40%,1,专业级
|
||||
山东大学,085600,材料与化工,109,78,187,42%,5,专业级
|
||||
山东大学,085601,材料工程,15,3,18,17%,2,专业级
|
||||
河南理工大学,085601,材料工程,98,4,102,4%,1,专业级
|
||||
浙江理工大学,085604,纺织工程,232,1,233,0%,2,专业级
|
||||
西北工业大学,085601,材料工程,181,189,370,51%,4,专业级
|
||||
西北工业大学,085602,化学工程,26,20,46,43%,2,专业级
|
||||
重庆大学,085600,材料与化工,142,59,201,29%,2,专业级
|
||||
长春理工大学,085600,材料与化工,60,1,61,2%,2,专业级
|
||||
院校,专业代码,专业名称,统考名额_不含推免,推免已接收,推免中学院组可核,推免中学院名近似,推免中仅同校同码,可核比例,可核方式,总规模,学院组数,N口径,推免占比
|
||||
东北大学,085601,材料工程,255,126,126,0,0,100%,学院名精确126,381,1,专业级,33%
|
||||
东北大学,085602,化学工程,35,6,6,0,0,100%,学院名精确6,41,1,专业级,15%
|
||||
东北大学,085603,冶金工程,184,60,60,0,0,100%,学院名精确60,244,1,专业级,25%
|
||||
东华大学,085600,材料与化工,404,56,56,0,0,100%,学院名精确56,460,5,专业级+方向级SUM,12%
|
||||
东南大学,085600,材料与化工,32,1,1,0,0,100%,学院名精确1,33,1,方向级SUM,3%
|
||||
东南大学,085601,材料工程,33,3,3,0,0,100%,学院名精确3,36,1,专业级,8%
|
||||
东南大学,085602,化学工程,49,11,11,0,0,100%,学院名精确11,60,2,专业级,18%
|
||||
中国矿业大学(北京),085601,材料工程,7,4,4,0,0,100%,学院名精确4,11,1,方向级SUM,36%
|
||||
中国矿业大学(北京),085602,化学工程,43,2,2,0,0,100%,学院名精确2,45,1,方向级SUM,4%
|
||||
中山大学,085600,材料与化工,57,25,25,0,0,100%,去掉前导院码后精确25,82,2,专业级,30%
|
||||
中山大学,085601,材料工程,59,59,59,0,0,100%,去掉前导院码后精确59,118,2,专业级,50%
|
||||
北京航空航天大学,085600,材料与化工,25,58,36,0,22,62%,按学院代码对上36,83,3,方向级SUM,70%
|
||||
北京航空航天大学,085601,材料工程,58,36,36,0,0,100%,按学院代码对上36,94,1,专业级,38%
|
||||
南京理工大学,085601,材料工程,144,36,36,0,0,100%,学院名精确36,180,3,方向级SUM,20%
|
||||
南京理工大学,085602,化学工程,96,25,25,0,0,100%,学院名精确25,121,1,专业级,21%
|
||||
合肥工业大学,085601,材料工程,85,48,48,0,0,100%,学院名精确48,133,4,专业级,36%
|
||||
合肥工业大学,085602,化学工程,28,19,19,0,0,100%,学院名精确19,47,1,专业级,40%
|
||||
山东大学,085600,材料与化工,109,78,78,0,0,100%,学院名精确78,187,5,专业级,42%
|
||||
山东大学,085601,材料工程,15,3,3,0,0,100%,学院名精确3,18,2,专业级,17%
|
||||
河南理工大学,085601,材料工程,98,4,4,0,0,100%,学院名精确4,102,1,专业级,4%
|
||||
浙江理工大学,085604,纺织工程,232,1,0,0,1,0%,,233,2,专业级,0%
|
||||
西北工业大学,085601,材料工程,181,189,163,0,26,86%,学院名精确163,370,4,专业级,51%
|
||||
西北工业大学,085602,化学工程,26,20,20,0,0,100%,学院名精确20,46,2,专业级,43%
|
||||
重庆大学,085600,材料与化工,142,59,59,0,0,100%,去掉前导院码后精确59,201,2,专业级,29%
|
||||
长春理工大学,085600,材料与化工,60,1,1,0,0,100%,学院名精确1,61,2,专业级,2%
|
||||
|
@@ -0,0 +1,123 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""给 0856 占比表补「三键可核 / 仅同校同码」两列。
|
||||
|
||||
占比表的推免数历来按 (校, 专业码) 粗粒度求和:同校其它院系公示的推免数也会被
|
||||
算进这个专业,跟缺口清单用的 (校, 学院, 专业码) 三键口径不一致,两个数摆在一起
|
||||
会被质疑。这里把每个 (校,码) 的推免数拆成「三键能对上目录学院组的」与
|
||||
「对不上、只有同校同码证据的」,占比仍用合计,但读者能看出有多少是粗粒度撑起来的。
|
||||
"""
|
||||
import collections
|
||||
import csv
|
||||
import re
|
||||
import sqlite3
|
||||
import unicodedata
|
||||
|
||||
OUT = r'D:/择校/审计报告/0856_统考名额与推免占比_20261101.csv'
|
||||
ZX = r'D:/择校/数据库/zexiao_2027.db'
|
||||
|
||||
|
||||
def norm(s):
|
||||
return re.sub(r'\s+', '', unicodedata.normalize('NFKC', str(s or '')))
|
||||
|
||||
|
||||
z = sqlite3.connect('file:' + ZX + '?mode=ro', uri=True)
|
||||
# 目录里每个 (校,码) 的合法学院组集合
|
||||
cat_name, cat_code = collections.defaultdict(set), collections.defaultdict(set)
|
||||
for dwmc, zydm, yxsmc, yxsdm in z.execute(
|
||||
"select dwmc,zydm,yxsmc,yxsdm from chsi_2027_dir where zydm like '0856%'"):
|
||||
k = (norm(dwmc), norm(zydm))
|
||||
if yxsmc:
|
||||
cat_name[k].add(norm(yxsmc))
|
||||
if yxsdm:
|
||||
cat_code[k].add(norm(yxsdm))
|
||||
|
||||
|
||||
def how(sch, code, college):
|
||||
"""公示侧学院怎么对上目录:原名 / 去掉前导院码 / 本来就是院码 / 名称互相包含。
|
||||
|
||||
中大公示写「290 材料科学与工程学院」,北航只写「001」,都是同一院系,
|
||||
不能因为字符串不等就判成不可核。
|
||||
"""
|
||||
k = (sch, code)
|
||||
names, codes = cat_name.get(k, set()), cat_code.get(k, set())
|
||||
c = norm(college)
|
||||
if not c:
|
||||
return None
|
||||
if c in names:
|
||||
return '学院名精确'
|
||||
stripped = re.sub(r'^[0-9]+', '', c)
|
||||
if stripped and stripped in names:
|
||||
return '去掉前导院码后精确'
|
||||
if c.isdigit() and c in codes:
|
||||
return '按学院代码对上'
|
||||
if stripped and any(n and (stripped in n or n in stripped) for n in names):
|
||||
return '学院名互相包含'
|
||||
return None
|
||||
|
||||
tri = collections.defaultdict(int) # (校,院,码) -> 人
|
||||
pair = collections.defaultdict(int)
|
||||
for t, vc in [('y2027_tuimian_2027', 'value'), ('y2027_tuimian_major', 'received_recommend_count')]:
|
||||
for s, c, m, v in z.execute("select school, college, major_code, %s from %s" % (vc, t)):
|
||||
if not re.match(r'^\d+$', str(v).strip()):
|
||||
continue
|
||||
n = int(v)
|
||||
tri[(norm(s), norm(c), norm(m))] += n
|
||||
pair[(norm(s), norm(m))] += n
|
||||
z.close()
|
||||
|
||||
rows = list(csv.DictReader(open(OUT, encoding='utf-8-sig')))
|
||||
cols = list(rows[0].keys())
|
||||
for r in rows:
|
||||
sch, code = norm(r['院校']), norm(r['专业代码'])
|
||||
total = int(r['推免已接收'])
|
||||
core = near = 0
|
||||
ways = collections.Counter()
|
||||
for (s, c, m), n in tri.items():
|
||||
if s != sch or m != code:
|
||||
continue
|
||||
h = how(sch, code, c)
|
||||
if h in ('学院名精确', '去掉前导院码后精确', '按学院代码对上'):
|
||||
core += n
|
||||
ways[h] += n
|
||||
elif h == '学院名互相包含':
|
||||
near += n
|
||||
ways[h] += n
|
||||
other = max(total - core - near, 0)
|
||||
r['推免中学院组可核'] = core
|
||||
r['推免中学院名近似'] = near
|
||||
r['推免中仅同校同码'] = other
|
||||
r['可核比例'] = '%.0f%%' % (100.0 * (core + near) / total) if total else ''
|
||||
r['可核方式'] = '+'.join('%s%d' % (k, v) for k, v in ways.most_common())
|
||||
r['目录学院组数'] = len(cat_name.get((sch, code), set()))
|
||||
fcols = cols[:5] + ['推免中学院组可核', '推免中学院名近似', '推免中仅同校同码', '可核比例',
|
||||
'可核方式'] + cols[5:]
|
||||
fcols = [c for c in fcols if c not in ('推免占比',)] + ['推免占比']
|
||||
fcols = list(dict.fromkeys([c for c in fcols if c in set(cols) | {
|
||||
'推免中学院组可核', '推免中学院名近似', '推免中仅同校同码', '可核比例', '可核方式',
|
||||
'目录学院组数'}]))
|
||||
with open(OUT, 'w', newline='', encoding='utf-8-sig') as f:
|
||||
w = csv.DictWriter(f, fieldnames=fcols, extrasaction='ignore')
|
||||
w.writeheader()
|
||||
w.writerows(rows)
|
||||
|
||||
L = ['=== 0856 占比表加口径列 ===', '行=%d 列=%s' % (len(rows), ','.join(fcols))]
|
||||
tot = sum(int(r['推免已接收']) for r in rows)
|
||||
core = sum(int(r['推免中学院组可核']) for r in rows)
|
||||
near = sum(int(r['推免中学院名近似']) for r in rows)
|
||||
oth = sum(int(r['推免中仅同校同码']) for r in rows)
|
||||
L.append('推免合计=%d 学院组可核=%d(%.0f%%) 名称近似=%d 仅同校同码=%d' % (
|
||||
tot, core, 100.0 * core / tot, near, oth))
|
||||
allw = collections.Counter()
|
||||
for r in rows:
|
||||
for m in re.finditer(r'([一-齥]+)(\d+)', r['可核方式'] or ''):
|
||||
allw[m.group(1)] += int(m.group(2))
|
||||
L.append('可核方式合计=%s' % allw.most_common())
|
||||
L.append('')
|
||||
L.append('%-12s %-8s %-6s %-6s %-6s %-6s %s' % ('校', '码', '占比', '推免', '可核', '仅粗', '比例'))
|
||||
for r in sorted(rows, key=lambda x: -int(x['推免已接收']))[:14]:
|
||||
L.append('%-12s %-8s %-6s %-5s %-6s %-6s %s' % (
|
||||
r['院校'][:12], r['专业代码'], r['推免占比'], r['推免已接收'],
|
||||
r['推免中学院组可核'], r['推免中仅同校同码'], r['可核比例']))
|
||||
open(r'D:/择校/运行暂存/agent_ingest_20261101/share_caliber_20261102.txt', 'w',
|
||||
encoding='utf-8').write('\n'.join(L) + '\n')
|
||||
print('\n'.join(L))
|
||||
@@ -0,0 +1,117 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""用「学院名归一」重判缺口清单的推免覆盖,修掉假缺。
|
||||
|
||||
公示侧的学院写法有三种:目录原名(材料科学与工程学院)、带前导院码
|
||||
(290 材料科学与工程学院)、只给院码(001)。之前只按原名比,后两种被误判成
|
||||
「该学院没公示」。这里把三种写法都归一回目录学院名再查,归不回的才记真缺。
|
||||
"""
|
||||
import collections
|
||||
import csv
|
||||
import re
|
||||
import sqlite3
|
||||
import unicodedata
|
||||
|
||||
GAP = r'D:/择校/审计报告/0856_2027定向缺口清单.csv'
|
||||
LOG = r'D:/择校/运行暂存/agent_ingest_20261101/gap_college_match_20261102.txt'
|
||||
|
||||
|
||||
def norm(s):
|
||||
return re.sub(r'\s+', '', unicodedata.normalize('NFKC', str(s or '')))
|
||||
|
||||
|
||||
z = sqlite3.connect('file:D:/择校/数据库/zexiao_2027.db?mode=ro', uri=True)
|
||||
name_by_code = collections.defaultdict(dict) # (校,码) -> {院码: 目录院名}
|
||||
valid_name = collections.defaultdict(set) # (校,码) -> {目录院名}
|
||||
for dwmc, zydm, yxsmc, yxsdm in z.execute("select dwmc,zydm,yxsmc,yxsdm from chsi_2027_dir where zydm like '0856%'"):
|
||||
k = (norm(dwmc), norm(zydm))
|
||||
if yxsmc:
|
||||
valid_name[k].add(norm(yxsmc))
|
||||
if yxsdm and yxsmc:
|
||||
name_by_code[k][norm(yxsdm)] = norm(yxsmc)
|
||||
|
||||
tri = collections.defaultdict(int)
|
||||
for t, vc in [('y2027_tuimian_2027', 'value'), ('y2027_tuimian_major', 'received_recommend_count')]:
|
||||
for s, c, m, v in z.execute("select school, college, major_code, %s from %s" % (vc, t)):
|
||||
if not re.match(r'^\d+$', str(v).strip()):
|
||||
continue
|
||||
tri[(norm(s), norm(c), norm(m))] += int(v)
|
||||
z.close()
|
||||
|
||||
|
||||
def canon(sch, code, college):
|
||||
"""把公示写法归一到目录学院名;归不回返回 None。"""
|
||||
k = (sch, code)
|
||||
c = norm(college)
|
||||
if not c:
|
||||
return None
|
||||
if c in valid_name.get(k, ()):
|
||||
return c, '原名'
|
||||
stripped = re.sub(r'^[0-9]+', '', c)
|
||||
if stripped and stripped in valid_name.get(k, ()):
|
||||
return stripped, '去前导院码'
|
||||
if c.isdigit() and c in name_by_code.get(k, {}):
|
||||
return name_by_code[k][c], '按院码映射'
|
||||
hit = next((n for n in valid_name.get(k, ()) if n and stripped and (stripped in n or n in stripped)), None)
|
||||
if hit:
|
||||
return hit, '名称互相包含'
|
||||
return None
|
||||
|
||||
|
||||
rows = list(csv.DictReader(open(GAP, encoding='utf-8-sig')))
|
||||
orig = [(r['缺推免接收数'], r['推免接收数_三键匹配']) for r in rows]
|
||||
ways = collections.Counter()
|
||||
for r in rows:
|
||||
sch, code = norm(r['院校']), norm(r['专业代码'])
|
||||
got = 0
|
||||
how = ''
|
||||
for (s, c, m), n in tri.items():
|
||||
if s != sch or m != code:
|
||||
continue
|
||||
std = canon(sch, code, c)
|
||||
if std and std[0] == norm(r['学院']):
|
||||
got += n
|
||||
how = std[1]
|
||||
if got:
|
||||
r['推免接收数_三键匹配'] = str(got)
|
||||
r['推免匹配方式'] = how
|
||||
ways[how] += 1
|
||||
r['缺推免接收数'] = ''
|
||||
else:
|
||||
r['推免接收数_三键匹配'] = ''
|
||||
r['推免匹配方式'] = ''
|
||||
r['缺推免接收数'] = '是'
|
||||
|
||||
cols = list(rows[0].keys())
|
||||
if '推免匹配方式' not in cols:
|
||||
cols.insert(cols.index('推免接收数_三键匹配') + 1, '推免匹配方式')
|
||||
with open(GAP, 'w', newline='', encoding='utf-8-sig') as f:
|
||||
w = csv.DictWriter(f, fieldnames=cols)
|
||||
w.writeheader()
|
||||
w.writerows(rows)
|
||||
|
||||
L = ['=== 缺口清单学院名归一后重判覆盖 ===']
|
||||
L.append('清单键=%d 校=%d' % (len(rows), len({r['院校'] for r in rows})))
|
||||
L.append('判前 缺=%d 有=%d' % (sum(1 for a, _ in orig if a == '是'),
|
||||
sum(1 for a, _ in orig if a != '是')))
|
||||
L.append('判后 缺=%d 有=%d(这次新补=%d,转缺=%d)' % (
|
||||
sum(1 for r in rows if r['缺推免接收数'] == '是'),
|
||||
sum(1 for r in rows if r['缺推免接收数'] != '是'),
|
||||
sum(1 for i, r in enumerate(rows) if orig[i][0] == '是' and r['推免接收数_三键匹配']),
|
||||
sum(1 for i, r in enumerate(rows) if orig[i][0] != '是' and not r['推免接收数_三键匹配']))
|
||||
)
|
||||
L.append('匹配方式命中的键数=%s' % ways.most_common())
|
||||
L.append('')
|
||||
L.append('新补上的键:')
|
||||
for i, r in enumerate(rows):
|
||||
if orig[i][0] == '是' and r['推免接收数_三键匹配']:
|
||||
L.append(' %-12s %-24s %s %-4s 推免=%-4s 靠%s' % (
|
||||
r['院校'], r['学院'][:24], r['专业代码'], r['学习方式'],
|
||||
r['推免接收数_三键匹配'], r['推免匹配方式']))
|
||||
L.append('')
|
||||
lost = [(i, r) for i, r in enumerate(rows) if orig[i][0] != '是' and not r['推免接收数_三键匹配']]
|
||||
L.append('转缺的键=%d' % len(lost))
|
||||
for i, r in lost[:8]:
|
||||
L.append(' %-12s %-24s %s 原值=%s' % (r['院校'], r['学院'][:24], r['专业代码'], orig[i][1]))
|
||||
open(LOG, 'w', encoding='utf-8').write('\n'.join(L) + '\n')
|
||||
print('\n'.join(L[:10]))
|
||||
print('... 明细见', LOG)
|
||||
@@ -0,0 +1,19 @@
|
||||
=== 缺口清单学院名归一后重判覆盖 ===
|
||||
清单键=983 校=362
|
||||
判前 缺=942 有=41
|
||||
判后 缺=932 有=51(这次新补=10,转缺=0)
|
||||
匹配方式命中的键数=[('原名', 41), ('去前导院码', 6), ('按院码映射', 4)]
|
||||
|
||||
新补上的键:
|
||||
中山大学 化学学院 085600 全日制 推免=16 靠去前导院码
|
||||
中山大学 化学工程与技术学院 085600 全日制 推免=9 靠去前导院码
|
||||
中山大学 材料学院 085601 全日制 推免=32 靠去前导院码
|
||||
中山大学 材料科学与工程学院 085601 全日制 推免=27 靠去前导院码
|
||||
北京航空航天大学 化学学院 085600 全日制 推免=12 靠按院码映射
|
||||
北京航空航天大学 杭州国际创新研究院 085600 全日制 推免=21 靠按院码映射
|
||||
北京航空航天大学 航空发动机研究院 085600 全日制 推免=3 靠按院码映射
|
||||
北京航空航天大学 材料科学与工程学院 085601 全日制 推免=36 靠按院码映射
|
||||
重庆大学 化学化工学院 085600 全日制 推免=13 靠去前导院码
|
||||
重庆大学 材料科学与工程学院 085600 全日制 推免=46 靠去前导院码
|
||||
|
||||
转缺的键=0
|
||||
@@ -0,0 +1,20 @@
|
||||
=== 0856 占比表加口径列 ===
|
||||
行=25 列=院校,专业代码,专业名称,统考名额_不含推免,推免已接收,推免中学院组可核,推免中学院名近似,推免中仅同校同码,可核比例,可核方式,总规模,学院组数,N口径,推免占比
|
||||
推免合计=930 学院组可核=881(95%) 名称近似=0 仅同校同码=49
|
||||
可核方式合计=[('学院名精确', 666), ('去掉前导院码后精确', 143), ('按学院代码对上', 72)]
|
||||
|
||||
校 码 占比 推免 可核 仅粗 比例
|
||||
西北工业大学 085601 51% 189 163 26 86%
|
||||
东北大学 085601 33% 126 126 0 100%
|
||||
山东大学 085600 42% 78 78 0 100%
|
||||
东北大学 085603 25% 60 60 0 100%
|
||||
中山大学 085601 50% 59 59 0 100%
|
||||
重庆大学 085600 29% 59 59 0 100%
|
||||
北京航空航天大学 085600 70% 58 36 22 62%
|
||||
东华大学 085600 12% 56 56 0 100%
|
||||
合肥工业大学 085601 36% 48 48 0 100%
|
||||
北京航空航天大学 085601 38% 36 36 0 100%
|
||||
南京理工大学 085601 20% 36 36 0 100%
|
||||
中山大学 085600 30% 25 25 0 100%
|
||||
南京理工大学 085602 21% 25 25 0 100%
|
||||
西北工业大学 085602 43% 20 20 0 100%
|
||||
Reference in new issue
Block a user