Retail draft word counts
Fixed issues with some sets, added more set codes for draftable sets, added CSV output file.
This commit is contained in:
parent
210a178845
commit
21a52cc5c2
2 changed files with 145 additions and 14 deletions
|
|
@ -1,11 +1,9 @@
|
||||||
import json
|
import json
|
||||||
import statistics
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
# Counts words on each card from each set using MTGJSON data.
|
# Counts words on each card from each set using MTGJSON data.
|
||||||
# I downloaded "all set files" from https://mtgjson.com/downloads/all-files/
|
# I downloaded "all set files" from https://mtgjson.com/downloads/all-files/
|
||||||
|
|
||||||
|
|
||||||
def load_set(code):
|
def load_set(code):
|
||||||
with open(f'mtgjson/sets/{code}.json', encoding='utf8') as f:
|
with open(f'mtgjson/sets/{code}.json', encoding='utf8') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
@ -14,14 +12,15 @@ def load_set(code):
|
||||||
cards = data['cards']
|
cards = data['cards']
|
||||||
|
|
||||||
|
|
||||||
def wc_fo(text):
|
|
||||||
# full oracle text word count
|
|
||||||
return len(text.split())
|
|
||||||
|
|
||||||
|
|
||||||
def analyze_set(code):
|
def analyze_set(code):
|
||||||
d = load_set(code)
|
d = load_set(code)
|
||||||
|
if 'data' in d:
|
||||||
|
d = d['data']
|
||||||
|
if 'cards' in d:
|
||||||
cards = d['cards']
|
cards = d['cards']
|
||||||
|
else:
|
||||||
|
print(f'No card data found in {code}.json')
|
||||||
|
return
|
||||||
faces = {}
|
faces = {}
|
||||||
#list text for all cards
|
#list text for all cards
|
||||||
for card in cards:
|
for card in cards:
|
||||||
|
|
@ -33,7 +32,11 @@ def analyze_set(code):
|
||||||
for card in cards:
|
for card in cards:
|
||||||
if 'side' in card:
|
if 'side' in card:
|
||||||
if card['side'] == 'a':
|
if card['side'] == 'a':
|
||||||
|
if 'text' not in card:
|
||||||
|
card['text'] = ""
|
||||||
|
elif card['otherFaceIds']:
|
||||||
card['text'] += " " + faces[card['otherFaceIds'][0]]
|
card['text'] += " " + faces[card['otherFaceIds'][0]]
|
||||||
|
|
||||||
# make card number an int
|
# make card number an int
|
||||||
if 'number' in card:
|
if 'number' in card:
|
||||||
try:
|
try:
|
||||||
|
|
@ -80,14 +83,22 @@ def analyze_set(code):
|
||||||
return textline
|
return textline
|
||||||
|
|
||||||
|
|
||||||
codes = ['LEA','3ED','4ED','5ED','6ED','7ED','8ED','9ED','10E','M10','M11','M12','M13','M14','M15','ORI','M19','M20','M21','ARN','ATQ','LEG','DRK','FEM','ICE','HML','ALL','MIR','VIS','WTH','TMP','STH','EXO','USG','ULG','UDS','MMQ','NEM','PCY','INV','PLS','APC','ODY','TOR','JUD','ONS','LGN','SCG','MRD','DST','5DN','CHK','BOK','SOK','RAV','GPT','DIS','CSP','TSP','PLC','FUT','LRW','MOR','SHM','EVE','ALA','CON','ARB','ZEN','WWK','ROE','SOM','MBS','NPH','ISD','DKA','AVR','RTR','GTC','DGM','THS','BNG','JOU','KTK','FRF','DTK','BFZ','OGW','SOI','EMN','KLD','AER','AKH','HOU','XLN','RIX','DOM','GRN','RNA','WAR','ELD','THB','IKO','ZNR']
|
codes = []
|
||||||
|
codes += ['LEA','3ED','4ED','5ED','6ED','7ED','8ED','9ED','10E','M10','M11','M12','M13','M14','M15','ORI','M19','M20',
|
||||||
|
'M21']
|
||||||
|
codes += ['POR','P02','PTK','S99']
|
||||||
|
codes += ['ARN','ATQ','LEG','DRK','FEM','HML']
|
||||||
|
codes += ['ICE','ALL','MIR','VIS','WTH','TMP','STH','EXO','USG','ULG','UDS','MMQ','NEM','PCY','INV','PLS','APC',
|
||||||
|
'ODY','TOR','JUD','ONS','LGN','SCG','MRD','DST','5DN','CHK','BOK','SOK','RAV','GPT','DIS','CSP',
|
||||||
|
'TSP','PLC','FUT','LRW','MOR','SHM','EVE','ALA','CON_','ARB','ZEN','WWK','ROE','SOM','MBS','NPH',
|
||||||
|
'ISD','DKA','AVR','RTR','GTC','DGM','THS','BNG','JOU','KTK','FRF','DTK','BFZ','OGW','SOI','EMN','KLD','AER',
|
||||||
|
'AKH','HOU','XLN','RIX','DOM','GRN','RNA','WAR','ELD','THB','IKO','ZNR']
|
||||||
|
codes += ['MMA','MM2','EMA','MM3','IMA','A25','UMA','2XM']
|
||||||
|
codes += ['MH1','CMR','JMP']
|
||||||
|
|
||||||
output = open('retail_set_words.csv', 'w+')
|
output = open('retail_set_words.csv', 'w+')
|
||||||
|
output.write('Set,c (mean),c (med),u (mean),u (med),r (mean),r (med),m (mean),m (med)\n')
|
||||||
for code in codes:
|
for code in codes:
|
||||||
# These sets trigger errors due to meld, MDFC, and other issues. Fixes needed.
|
|
||||||
if code in ['CON', 'SOI', 'EMN', 'ELD', 'ZNR']:
|
|
||||||
continue
|
|
||||||
line = analyze_set(code)
|
line = analyze_set(code)
|
||||||
output.write(line + '\n')
|
output.write(line + '\n')
|
||||||
output.close()
|
output.close()
|
||||||
|
|
|
||||||
120
retail_set_words.csv
Normal file
120
retail_set_words.csv
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
Set,c (mean),c (med),u (mean),u (med),r (mean),r (med),m (mean),m (med)
|
||||||
|
LEA,14.7,10.0,16.1,14,22.2,17.5,0,0
|
||||||
|
3ED,14.9,10,15.4,14,21.3,17,0,0
|
||||||
|
4ED,14.8,10,16.2,14,25.2,20.5,0,0
|
||||||
|
5ED,15.5,14,17.8,15.5,23.8,20,0,0
|
||||||
|
6ED,10.4,9.5,12.4,11.5,18.5,15.0,0,0
|
||||||
|
7ED,10.2,9.0,11.4,10.5,14.3,14.0,0,0
|
||||||
|
8ED,9.8,9,11.9,11,16.5,14,0,0
|
||||||
|
9ED,10.5,9.0,12.5,11.0,18.5,15,0,0
|
||||||
|
10E,13.6,12,17.2,14.0,20.5,18,0,0
|
||||||
|
M10,10.0,9,14.8,12.0,21.1,19,32.3,33
|
||||||
|
M11,11.7,10,14.5,12.5,23.9,24,26.9,26
|
||||||
|
M12,11.8,11,17.5,18.0,25.0,22,32.9,32
|
||||||
|
M13,11.6,11,21.6,18.0,22.2,19,34.1,36
|
||||||
|
M14,12.2,11,16.9,17.0,25.9,25,37.5,37
|
||||||
|
M15,16.8,15,22.2,19.0,30.5,32,41.9,40
|
||||||
|
ORI,19.7,17,25.2,22.5,29.3,29,58.4,47.5
|
||||||
|
M19,11.3,11,19.4,18.0,26.1,24,39.9,39.5
|
||||||
|
M20,15.2,15.0,23.4,21,31.8,32,47.5,51
|
||||||
|
M21,16.8,16,24.3,23.0,32.5,34,46.3,50.5
|
||||||
|
POR,6.6,8.0,10.4,10,15.2,13,0,0
|
||||||
|
P02,7.1,8.0,12.8,12,13.7,14,0,0
|
||||||
|
PTK,8.0,9,14.0,12,18.0,17,0,0
|
||||||
|
S99,5.9,4,9.4,10,12.5,11,0,0
|
||||||
|
ARN,21.3,14.0,21.7,19,24.0,20.5,0,0
|
||||||
|
ATQ,17.2,16.0,21.3,18,33.1,25.0,0,0
|
||||||
|
LEG,16.9,13,21.5,17.5,25.4,20,0,0
|
||||||
|
DRK,14.5,11,21.3,17.5,28.7,27,0,0
|
||||||
|
FEM,23.1,19.5,29.8,27,28.9,23.5,0,0
|
||||||
|
HML,17.6,12,18.6,15,25.2,22.0,0,0
|
||||||
|
ICE,21.3,17.0,23.5,19,33.2,33,0,0
|
||||||
|
ALL,20.7,19.0,31.0,29,39.9,41.0,0,0
|
||||||
|
MIR,22.3,21,20.0,19.0,29.4,25.5,0,0
|
||||||
|
VIS,19.7,18.5,25.7,22,28.8,26.0,0,0
|
||||||
|
WTH,18.4,16.0,21.2,17,26.4,22.5,0,0
|
||||||
|
TMP,14.3,13.0,17.2,14.0,22.6,19.0,0,0
|
||||||
|
STH,14.1,11,21.9,20.5,23.5,22.0,0,0
|
||||||
|
EXO,16.6,15,20.7,18.5,26.4,25.0,0,0
|
||||||
|
USG,15.8,14.0,17.3,15.0,22.3,21.0,0,0
|
||||||
|
ULG,16.6,14,20.5,15.5,22.9,22.0,0,0
|
||||||
|
UDS,13.6,11,22.3,22.5,18.5,16.0,0,0
|
||||||
|
MMQ,15.0,13.0,18.0,16.0,20.4,18.0,0,0
|
||||||
|
NEM,19.0,15,23.5,22.5,29.1,23.0,0,0
|
||||||
|
PCY,15.0,14,18.0,17.5,23.2,21.0,0,0
|
||||||
|
INV,19.5,16.0,17.9,15.0,24.1,20.5,0,0
|
||||||
|
PLS,20.3,17,24.9,22.5,27.3,25,0,0
|
||||||
|
APC,17.8,17,27.8,28.0,26.3,17.0,0,0
|
||||||
|
ODY,18.5,19.0,18.9,17.5,22.8,20.0,0,0
|
||||||
|
TOR,23.0,23,25.9,26.5,26.2,26.5,0,0
|
||||||
|
JUD,19.3,18,26.5,28.0,26.3,25.5,0,0
|
||||||
|
ONS,20.9,18.5,23.6,21.0,23.7,23.0,0,0
|
||||||
|
LGN,21.0,19,22.1,22,28.3,25,0,0
|
||||||
|
SCG,23.5,23,23.2,22.0,30.0,31.0,0,0
|
||||||
|
MRD,13.8,12.5,19.9,16.5,27.3,24.0,0,0
|
||||||
|
DST,16.7,16,24.6,23,27.5,27,0,0
|
||||||
|
5DN,21.6,20,18.1,17,25.4,23,0,0
|
||||||
|
CHK,19.8,17.0,22.8,20,27.7,24.5,0,0
|
||||||
|
BOK,23.9,18,30.4,30,30.1,28,0,0
|
||||||
|
SOK,21.7,19,22.5,22,29.4,27,0,0
|
||||||
|
RAV,19.9,17.0,22.4,19.0,27.9,24.0,0,0
|
||||||
|
GPT,19.9,20,19.5,18,27.7,24,0,0
|
||||||
|
DIS,20.2,20.5,25.7,23.0,31.2,29.0,0,0
|
||||||
|
CSP,22.7,21.0,28.8,24,36.4,34.0,0,0
|
||||||
|
TSP,26.5,23,29.8,30.0,35.5,33.5,0,0
|
||||||
|
PLC,24.0,18.0,30.5,29,34.6,28.0,0,0
|
||||||
|
FUT,29.5,26.0,32.1,28.0,31.8,27.5,0,0
|
||||||
|
LRW,21.8,18,27.4,27.0,31.4,29.0,0,0
|
||||||
|
MOR,21.8,18.0,35.0,36.0,30.7,28.0,0,0
|
||||||
|
SHM,20.6,15,20.0,17.5,24.5,24,0,0
|
||||||
|
EVE,22.6,20.0,25.4,21.5,27.0,28.0,0,0
|
||||||
|
ALA,16.8,16,20.3,17.0,27.3,25,29.7,30
|
||||||
|
CON,18.9,17.5,20.2,18.0,24.8,23,27.0,24.0
|
||||||
|
ARB,24.4,24.5,23.0,18.5,26.4,21,26.6,24.0
|
||||||
|
ZEN,20.2,19,25.0,23.5,31.6,28,31.6,28
|
||||||
|
WWK,20.9,21.5,27.1,26.0,28.3,31,34.9,36.0
|
||||||
|
ROE,17.2,16.5,22.3,22.5,28.1,27,33.1,39
|
||||||
|
SOM,16.5,15,22.2,20.5,27.8,23,33.7,29
|
||||||
|
MBS,15.6,14.0,21.5,20.5,25.6,25,30.8,26.5
|
||||||
|
NPH,18.6,19.0,24.8,21.5,31.2,31,29.2,29.5
|
||||||
|
ISD,16.7,15,20.7,18,26.6,23,35.1,34.5
|
||||||
|
DKA,19.5,20.5,25.2,26.5,33.1,30.0,37.9,31.0
|
||||||
|
AVR,18.0,15,20.4,17.0,26.9,24,31.3,33
|
||||||
|
RTR,16.9,15,20.3,21.0,28.2,25,31.3,30
|
||||||
|
GTC,16.8,15,22.0,20.0,30.4,29,38.3,35
|
||||||
|
DGM,16.6,13.0,24.6,19.5,34.4,35,40.4,39
|
||||||
|
THS,17.8,14,26.8,24.0,31.3,29,41.5,44
|
||||||
|
BNG,19.0,16.5,27.2,25.0,34.4,35,42.6,43.5
|
||||||
|
JOU,18.5,18.0,26.9,26.5,24.6,23,39.1,37.5
|
||||||
|
KTK,18.5,18,22.7,21.0,27.7,25,38.7,38
|
||||||
|
FRF,21.1,21.0,27.1,26.0,39.1,42,40.6,36.5
|
||||||
|
DTK,20.6,18,27.8,23.5,35.1,37,39.1,40
|
||||||
|
BFZ,19.7,20,24.9,23.5,30.7,32,37.3,36
|
||||||
|
OGW,17.3,17.5,22.7,21.0,32.2,31.5,38.5,39.5
|
||||||
|
SOI,19.4,19,27.6,24.5,34.4,31.5,42.9,42.0
|
||||||
|
EMN,18.4,18,27.7,26.5,32.0,29.5,44.9,42
|
||||||
|
KLD,18.2,18.0,20.4,20.0,32.2,31,44.1,46
|
||||||
|
AER,18.8,19,25.4,24.0,29.6,28.5,38.0,37.0
|
||||||
|
AKH,18.1,18,25.2,25.5,30.7,29,42.0,39
|
||||||
|
HOU,17.7,17.5,26.8,25.5,31.9,30.5,43.1,43.5
|
||||||
|
XLN,16.3,16,20.5,19.5,32.2,28,29.3,35
|
||||||
|
RIX,14.5,13.5,23.5,20.0,35.2,33.5,41.1,39
|
||||||
|
DOM,18.2,17,24.9,21.0,29.4,26,40.5,39
|
||||||
|
GRN,17.6,13,26.1,24.0,30.3,30,44.7,41
|
||||||
|
RNA,15.8,14,24.9,24.5,29.6,28,49.1,46
|
||||||
|
WAR,17.1,16,27.7,28.0,41.5,45.0,48.3,49.0
|
||||||
|
ELD,21.5,22,26.0,25.0,32.9,32,42.5,45
|
||||||
|
THB,18.2,18,32.1,30.0,34.9,33,50.8,51
|
||||||
|
IKO,18.5,18,29.7,27.0,37.0,39,55.9,55
|
||||||
|
ZNR,22.4,21,28.9,28.0,35.3,36.0,54.4,50
|
||||||
|
MMA,26.3,26,26.9,27.5,33.1,34,29.3,28
|
||||||
|
MM2,21.2,20,23.7,24.0,27.6,27,31.9,30
|
||||||
|
EMA,18.4,18,21.2,19.0,23.2,21,31.1,29
|
||||||
|
MM3,18.4,14,18.3,14.5,27.9,25,32.1,34
|
||||||
|
IMA,21.2,18,22.9,23.5,25.9,24,25.6,28
|
||||||
|
A25,19.3,17,22.8,19.0,23.8,22,32.8,36
|
||||||
|
UMA,22.3,21,24.4,24.0,28.2,24,31.6,33.0
|
||||||
|
2XM,21.9,21,23.1,21.0,23.6,21,35.7,36.0
|
||||||
|
MH1,25.0,26.0,24.8,22.0,31.0,27,45.7,50
|
||||||
|
CMR,21.0,17.0,29.2,26.0,36.5,36,38.5,37.0
|
||||||
|
JMP,15.6,14.5,18.9,16,25.6,24,32.1,35
|
||||||
|
Loading…
Add table
Add a link
Reference in a new issue