File size: 167 Bytes
386dc73
 
 
 
 
 
1
2
3
4
5
6
def hscore(text):
    cnt = 0
    for i in range(len(text)):
        if text[i:i+1] in keywords or text[i:i+2] in keywords:
            cnt+=1
    return cnt/len(text)