Last active
August 23, 2017 16:56
-
-
Save Jian-Qiao/f3b39651c7ebbc072f3c4727bc7c99d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shrink(k): | |
return 1-1/np.exp(k) | |
def my_search_in_docu(sentence, docu): | |
wf=[] | |
for word in sentence.split(): | |
wf.append((np.array(docu.split())==[word]).sum()) | |
return shrink(np.array(wf)).mean() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment