Exemplo n.º 1
0
    # given unicode floats, convert them into ints*1000
    v_master_verb_counts[i['urlPrefix']] = int(float(i['freq']) * 1000)
    if "needsNoun" in i:
        assert(i["needsNoun"] != "")
        needs_noun.append(i['urlPrefix'])

noun_counts = {}
verb_counts = {}

if (RUN_STATS_ONLY):
    trials = 100
else:
    trials = 1

trace_size = TRACE_SIZE
v_nouns = Variate(master_noun_counts)
v_verbs = Variate(v_master_verb_counts)

recorded_nouns = []
for j in range(0, trials):
    for i in range(0, trace_size):
        if (ENABLE_DEBUG_OUT):
            if ((i % DEBUG_PRINTOUT_FREQ == 0) and (j == 0) and (i != 0)):
                sys.stderr.write("picked %d\n" % (i))

        # pick verb
        verb = v_verbs.getRand()

        # pick noun
        noun = v_nouns.getRand()