c6b386f65b6295d4fbe691f7eb78ec4982009ef9,jieba/posseg/viterbi.py,,get_top_states,#Any#Any#,5

Before Change


MIN_INF = float("-inf")

def get_top_states(t_state_v, K=4):
    topK = sorted(t_state_v.items(), key=operator.itemgetter(1), reverse=True)[:K]
    return [x[0] for x in topK]

def viterbi(obs, states, start_p, trans_p, emit_p):
    V = [{}] //tabular
    mem_path = [{}]

After Change


MIN_INF = float("-inf")

def get_top_states(t_state_v, K=4):
    return sorted(t_state_v, key=t_state_v.__getitem__, reverse=True)[:K]

def viterbi(obs, states, start_p, trans_p, emit_p):
    V = [{}] //tabular
    mem_path = [{}]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: fxsjy/jieba
Commit Name: c6b386f65b6295d4fbe691f7eb78ec4982009ef9
Time: 2014-11-29
Author: abcdoyle888@gmail.com
File Name: jieba/posseg/viterbi.py
Class Name:
Method Name: get_top_states


Project Name: fxsjy/jieba
Commit Name: 751ff35eb5faa6460038bb20a1ef6bfcf29f440a
Time: 2014-10-31
Author: abcdoyle888@gmail.com
File Name: jieba/analyse/__init__.py
Class Name:
Method Name: extract_tags


Project Name: fxsjy/jieba
Commit Name: 7b7c6955a9119734ac70f902129b7fbfd1f0b660
Time: 2014-11-28
Author: abcdoyle888@gmail.com
File Name: jieba/posseg/viterbi.py
Class Name:
Method Name: get_top_states