fork download
  1. @Mathematica
  2.  
  3. wordSuggestion[str_]:=Module[{url,symbols,pattern,words},
  4.  
  5. (* Data & Parameter *)
  6. url="https://w...content-available-to-author-only...u.edu/~rgs/alice-I.html";
  7.  
  8. symbols=RegularExpression["[!-/:-@¥[-`{-~]"];
  9.  
  10. pattern=RegularExpression[str<>".*"];
  11.  
  12. (* Analysis *)
  13. words=url//
  14. Import//
  15. StringReplace[#,symbols->""]&//
  16. StringSplit//
  17. DeleteDuplicates;
  18.  
  19. (* Results *)
  20. words//
  21. Select[#,StringMatchQ[#,pattern]&]&
  22. ];
  23.  
  24.  
  25. In[1] := wordSuggestion["on"]
  26. Out[1] = {"on", "once", "one", "only"}
  27.  
  28. In[2] := wordSuggestion["we"]
  29. Out[2] = {"well", "went", "were"}
  30.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty