Skip to content

Instantly share code, notes, and snippets.

@Anwarvic
Created May 14, 2019 10:37
Show Gist options
  • Select an option

  • Save Anwarvic/6eddb7109fc24579cd0f7bde2af37612 to your computer and use it in GitHub Desktop.

Select an option

Save Anwarvic/6eddb7109fc24579cd0f7bde2af37612 to your computer and use it in GitHub Desktop.
from joblib import Parallel, delayed
def post_request(word):
response = requests.post("http://172.18.7.39:8181/stemSentence",
data={'sentence': word})
stem = ''
if '"error":false' in response.text:
response = eval(response.text.replace('false', 'False'))
stem = response['stemmedSentence']
return stem
result = Parallel(n_jobs=12, backend="threading")(
delayed(post_request)(word) \
for word in tqdm(unique_words, desc="Stemming"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment