Message Boards Message Boards


Getting Input from FormFunction[]

Posted 8 years ago
0 Replies
0 Total Likes

I'm having a lot of difficulty working with URL inputs from FormFunction[]. I'm trying to write a program that will compose a title for an article or text from a given webpage. The first step is to gather information about the text by counting the usage of words. I use Tally[] to count the words, but the words must be normalized. I've gotten normalization and deployment to work, but not all together. Here is what I have so far:

NormalizeInput = Function[
    inputStrings = StringSplit[
    Import[site, "Plaintext" ],
      WordCharacter] ..
    ];(*Imports plaintext from the webpage, 
     then splits words into strings*)

    loweredStrings = ToLowerCase[
    ];(*Normalizes the input data*)

    sortedFreq = Sort[
    #1[[2]] > #2[[2]] &
    ];(*Counts occurances of words then sorts*)

    shortedFreq = Cases[
    {a_, b_} /; b > 3
    ](*Lists words that occur more than twice*)

    CloudDeploy @ FormFunction[{
    "Website" -> <| "Interpreter" -> "SemanticURL", 
    "Input" -> ""|>
   inputNormed = NormalizeInput[#Website] &;

   inputNormed[[[All, 2]]],
   ChartLegends -> inputNormed[[[All, 1]]], 
   ChartStyle -> ColorData[ "WebSafe"]
  AppearanceRules -> <|
  "Title" -> "Word Counter",
  "Description" -> "Counts how often words repeat on a webpage."

To be more specific, this is the section that I feel is causing me trouble:

CloudDeploy @ FormFunction[{
    "Website" -> <| "Interpreter" -> "SemanticURL", 
    "Input" -> ""|>
   inputNormed = NormalizeInput[#Website] &;

By the way, I am new to Wolfram Programming. I just started this week, so please feel free to point out any of my stupidity or give helpful suggestions toward my writing techniques!

POSTED BY: Thomas Criss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract