text: #!/usr/bin/env python3
  #importing packages
  import pdfminer
  import io, sys
  import requests
  from pdfminer.converter import TextConverter
  from pdfminer.pdfinterp import PDFPageInterpreter
  from pdfminer.pdfinterp import PDFResourceManager
  from pdfminer.pdfpage import PDFPage
  import numpy as np
  import pandas as pd
  from PIL import Image
  from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
  import matplotlib.pyplot as plt
  import seaborn as sns
  from textblob import TextBlob
  
  if not sys.argv[2] or not sys.argv[1]:
      print('usage:  cmd "<pdf_url>" "<mask_url>" "[optional, additional, stop, words]"')
      exit()
  
  pdf_url = sys.argv[1]
  mask_url = sys.argv[2]
  if len(sys.argv[3]) > 0:
      n = len(sys.argv[3])
      additional_words = sys.argv[3][1:n-1]
      additional_words = additional_words.split(', ')
  
  #defining function 
  #reference: http://www.blog.pythonlibrary.org/2018/05/03/exporting-data-from-pdfs-with-python/
  def extract_text_from_pdf(pdf):
      resource_manager = PDFResourceManager()
      fake_file_handle = io.StringIO()
      converter = TextConverter(resource_manager, fake_file_handle)
      page_interpreter = PDFPageInterpreter(resource_manager, converter)
      for page in PDFPage.get_pages(pdf, 
                                    caching=True,
                                    check_extractable=True):
          page_interpreter.process_page(page)
      text = fake_file_handle.getvalue()
      # close open handles
      converter.close()
      fake_file_handle.close()
      if text:
          return text
  
  #executing function and printing text
  response = requests.get(pdf_url)
  text = extract_text_from_pdf(io.BytesIO(response.content))
  #print(text)
  
  
  #removing numbers
  def remove_num(text):
      text = ''.join([i for i in text if not i.isdigit()])
      return text
  
  #executing function
  text = np.vectorize(remove_num)(text)
  
  #--------------------------------------------------------------------------------------
  #removing punctuation
  from string import punctuation
  def remove_punct(text):
      text = ' '.join(word.strip(punctuation) for word in text.split() if word.strip(punctuation))
      return text
  
  #executing function
  text = np.vectorize(remove_punct)(text)
  
  #--------------------------------------------------------------------------------------
  
  #removing other characters
  def remove_u(text):
      text = text.replace('_','')
      text = text.replace('?','')
      text = text.replace('•','')
      text = text.replace("@",'')
      text = text.replace('▯','')
      text = text.replace("'",'')
      text = text.replace(",","")
      return text
  
  #executing function
  text = np.vectorize(remove_u)(text)
  
  #--------------------------------------------------------------------------------------
  
  #removing extra spaces
  def remove_extra_space(text):
      word_list = text.split()
      text = ' '.join(word_list)
      return text
  
  #executing function
  text = np.vectorize(remove_extra_space)(text)
  
  #--------------------------------------------------------------------------------------
  
  #removing very common words
  stop_words = ["i", "me", "my", "myself", "we", "our", "ours", "ourselves", "you", "your", "yours", "yourself", "yourselves", "he", "him", "his", "himself", "she", "her", "hers", "herself", "it", "its", "itself", "they", "them", "their", "theirs", "themselves", "what", "which", "who", "whom", "this", "that", "these", "those", "am", "is", "are", "was", "were", "be", "been", "being", "have", "has", "had", "having", "do", "does", "did", "doing", "a", "an", "the","Mr", "and", "but", "if", "or", "because", "as", "until", "while", "of", "at", "by", "for", "with", "about", "against", "between", "into", "through", "during", "before", "after", "above", "below", "to", "from", "up", "down", "in", "out", "on", "off", "over", "under", "again", "further", "then", "once", "here", "there", "when", "where", "why", "how", "all", "any", "both", "each", "few", "more", "most", "other", "some", "such", "no", "nor", "not", "only", "own", "same", "so", "than", "too", "very", "s", "t", "can", "will", "just", "don", "should", "now"]
  stop_words.extend(additional_words)
  def remove_stopwords(text):
      word_list = text.split()
      word_list = [word for word in word_list if word not in stop_words]
      text = ' '.join(word_list)
      return text
  
  #executing function
  text = np.vectorize(remove_stopwords)(text)
  text = text.tolist()
  #print(text)
  #print(stop_words)
  
  #--------------------------------------------------------------------------------------
  
  #setting mask image
  response = requests.get(mask_url)
  mask = np.array(Image.open(io.BytesIO((response.content))))
  plt.imshow(mask)
  plt.axis("off")
  
  
  wordcloud = WordCloud(mask=mask, width=2000, height=1000,contour_color="black", max_words=10000,relative_scaling = 0, background_color = "white").generate(text)
  image_colors = ImageColorGenerator(mask)
  plt.figure(figsize=[20,15])
  plt.imshow(wordcloud.recolor(color_func=image_colors), interpolation="bilinear")
  plt.axis("off")
  _=plt.show()
  