Skip to content

Instantly share code, notes, and snippets.

@Jian-Qiao
Last active August 23, 2017 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jian-Qiao/f3b39651c7ebbc072f3c4727bc7c99d0 to your computer and use it in GitHub Desktop.
Save Jian-Qiao/f3b39651c7ebbc072f3c4727bc7c99d0 to your computer and use it in GitHub Desktop.
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