Use the productivity metric.
This commit is contained in:
parent
0e189ecbac
commit
7650a1b784
12
words.py
12
words.py
|
@ -27,13 +27,16 @@ Q: set[tuple[tuple[str, int], tuple[str, int]]] = {
|
|||
((x, xr), (y, yr)) for x, xr, y, yr in r.fetchall()
|
||||
}
|
||||
|
||||
productivity : dict[str, int] = {}
|
||||
|
||||
while Q:
|
||||
log.info('%d items queued', len(Q))
|
||||
# (x, x_rank), (y, y_rank) = random.choice(list(Q))
|
||||
((x, x_rank), (y, y_rank)), = random.sample(
|
||||
population=list(Q),
|
||||
k=1,
|
||||
counts=[max(len(x), len(y))*max(xr, yr) for (x, xr), (y, yr) in Q],
|
||||
#counts=[max(xr, yr) for (x, xr), (y, yr) in Q],
|
||||
counts=[productivity.get(x, 1)*productivity.get(y, 1) for (x, xr), (y, yr) in Q],
|
||||
)
|
||||
Q.remove(((x, x_rank), (y, y_rank)))
|
||||
|
||||
|
@ -50,8 +53,8 @@ while Q:
|
|||
z = response['result']
|
||||
is_new = response['isNew']
|
||||
log.info(
|
||||
'%s (%d) + %s (%d) -> %s%s',
|
||||
x, x_rank, y, y_rank, z,
|
||||
'%s (%d/%d) + %s (%d/%d) -> %s%s',
|
||||
x, x_rank, productivity.get(x, 0), y, y_rank, productivity.get(y, 0), z,
|
||||
' [NEW!]' if is_new else ''
|
||||
)
|
||||
|
||||
|
@ -80,4 +83,7 @@ while Q:
|
|||
for q, q_rank, z_rank in r.fetchall():
|
||||
Q.add(((z, z_rank), (q, q_rank)))
|
||||
|
||||
r = db.execute('select x, count(distinct z) as cnt from combos group by x')
|
||||
productivity = {w: score for w, score in r.fetchall()}
|
||||
|
||||
time.sleep(5)
|
||||
|
|
Loading…
Reference in New Issue