-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscoring.js
182 lines (165 loc) · 3.81 KB
/
scoring.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// Ivan's Workshop
// in pairs of lower bound, upper bound
var base = {
'SS': 2612.7,
'S': 2089.35,
'A': 1690.65,
'B': 1309.8,
'C': 817.5
}
var hairSize = 0.5;
var hairScoring = {
'SS': base['SS'] * hairSize,
'S': base['S'] * hairSize,
'A': base['A'] * hairSize,
'B': base['B'] * hairSize,
'C': base['C'] * hairSize
}
var dressSize = 2;
var dressScoring = {
'SS': base['SS'] * dressSize,
'S': base['S'] * dressSize,
'A': base['A'] * dressSize,
'B': base['B'] * dressSize,
'C': base['C'] * dressSize
};
var coatSize = 0.2;
var coatScoring = {
'SS': base['SS'] * coatSize,
'S': base['S'] * coatSize,
'A': base['A'] * coatSize,
'B': base['B'] * coatSize,
'C': base['C'] * coatSize
};
var topSize = 1;
var topScoring = {
'SS': base['SS'] * topSize,
'S': base['S'] * topSize,
'A': base['A'] * topSize,
'B': base['B'] * topSize,
'C': base['C'] * topSize
};
var bottomSize = 1;
var bottomScoring = {
'SS': base['SS'] * bottomSize,
'S': base['S'] * bottomSize,
'A': base['A'] * bottomSize,
'B': base['B'] * bottomSize,
'C': base['C'] * bottomSize
};
var sockSize = 0.3;
var sockScoring = {
'SS': base['SS'] * sockSize,
'S': base['S'] * sockSize,
'A': base['A'] * sockSize,
'B': base['B'] * sockSize,
'C': base['C'] * sockSize
};
var shoeSize = 0.4;
var shoeScoring = {
'SS': base['SS'] * shoeSize,
'S': base['S'] * shoeSize,
'A': base['A'] * shoeSize,
'B': base['B'] * shoeSize,
'C': base['C'] * shoeSize
};
var accessoriesSize = 0.2;
var accessoriesScoring = {
'SS': base['SS'] * accessoriesSize,
'S': base['S'] * accessoriesSize,
'A': base['A'] * accessoriesSize,
'B': base['B'] * accessoriesSize,
'C': base['C'] * accessoriesSize
};
var makeupSize = 0.1;
var makeupScoring = {
'SS': base['SS'] * makeupSize,
'S': base['S'] * makeupSize,
'A': base['A'] * makeupSize,
'B': base['B'] * makeupSize,
'C': base['C'] * makeupSize
};
function avg(score) {
ret = {};
for (s in score) {
ret[s] = (score[s][0] + score[s][1]) / 2;
}
return ret;
}
function sigma(score) {
ret = {};
for (s in score) {
ret[s] = (score[s][0] - score[s][1]) / 2;
}
return ret;
}
var scoring = {
'发型': hairScoring,
'连衣裙': dressScoring,
'外套': coatScoring,
'上装': topScoring,
'下装': bottomScoring,
'袜子': sockScoring,
'鞋子': shoeScoring,
'饰品': accessoriesScoring,
'妆容': makeupScoring
}
var scoringSize = {
'发型': hairSize,
'连衣裙': dressSize,
'外套': coatSize,
'上装': topSize,
'下装': bottomSize,
'袜子': sockSize,
'鞋子': shoeSize,
'饰品': accessoriesSize,
'妆容': makeupSize
}
var deviation = {
'发型': sigma(hairScoring),
'连衣裙': sigma(dressScoring),
'外套': sigma(coatScoring),
'上装': sigma(topScoring),
'下装': sigma(bottomScoring),
'袜子': sigma(sockScoring),
'鞋子': sigma(shoeScoring),
'饰品': sigma(accessoriesScoring),
'妆容': sigma(makeupScoring)
}
function getScore(clothesType) {
if (scoring[clothesType]) {
return scoring[clothesType];
}
if (scoring[clothesType.split('-')[0]]) {
return scoring[clothesType.split('-')[0]];
}
return {};
}
function getDeviation(clothesType) {
if (deviation[clothesType]) {
return deviation[clothesType];
}
if (deviation[clothesType.split('-')[0]]) {
return deviation[clothesType.split('-')[0]];
}
return {};
}
var typeInfo = function() {
var ret = {};
for (var i in category) {
var name = category[i];
ret[name] = {
type: name,
mainType: name.split('-')[0],
score: getScore(name),
deviation: getDeviation(name),
needFilter: function() {
return this.mainType == "连衣裙"
|| this.mainType == "外套"
|| this.mainType == "上装"
|| this.mainType == "下装";
}
}
}
return ret;
}();