docs: def computePDFSimilarity(paperId, userPDF):
      if not isPDFInDb(paperId):
           return None
  
      userPDF.save("temp.pdf")
      # check_call is blocking
      check_call(['pdftotext', '-enc', 'UTF-8', "temp.pdf", "temp.txt"])
      os.remove("temp.pdf")
      
      a = open("temp.txt", 'r').read()
      b = open(join(dbPath, paperId) + ".txt", 'r').read()
  
      import nltk, string
      from sklearn.feature_extraction.text import TfidfVectorizer
  
      stemmer = nltk.stem.porter.PorterStemmer()
      remove_punctuation_map = dict((ord(char), None) for char in string.punctuation)
  
      def stem_tokens(tokens):
          return [stemmer.stem(item) for item in tokens]
  
      '''remove punctuation, lowercase, stem'''
      def normalize(text):
          return stem_tokens(nltk.word_tokenize(text.lower().translate(remove_punctuation_map)))
  
      vectorizer = TfidfVectorizer(tokenizer=normalize, stop_words='english')
  
      def cosine_sim(text1, text2):
          tfidf = vectorizer.fit_transform([text1, text2])
          return ((tfidf * tfidf.T).A)[0,1]
  
      similarity = cosine_sim(a, b)
  
      os.remove("temp.txt")
  
      return similarity