Sales-Choice-Volunteering-Project / EmotionAnalyzerWeka

The program for obtaining emotion data
1 stars 0 forks source link

Think and work on possible JavaScript functions to be embedded in frontend #24

Closed sherlockliang888 closed 3 years ago

sherlockliang888 commented 3 years ago
  1. Think about the functions on the buttons and test if they work;
  2. Decide and code how data would be stored (in what format);
sherlockliang888 commented 3 years ago
  1. When textbox is not empty, click "next" button with save input as a variable sentence_n and store it, otherwise it asks user for an input, then the result of analyzer will display and will be stored as resultn1.
  2. User choose if they are satisfied with the predicted resultn1: if yes, click "next" send [resultn1, resultn1][1] to the stored sentence_n, then return home page; if no, click "next" will trigger next part.
  3. User choose the correct emotion from radio buttons listed, click "send" will store the result as [resultn1, resultc1], in which resultc1 stands for the correction of resultn1. [resultn1, resultc1][1] will be stored with sentence_n, then return to home page.
  4. When click all the buttons, user has to make a choice on the radio buttons: input can't be empty.
  5. Is a "Go Back" step necessary?
  6. Input sentence_n will have a key, and it can be timestamp, i.e. Sentence_20210808105126 so that they are unique.
  7. Data training happen once per day? per week?

Needs PR

damirsaleschoice commented 3 years ago

Are you familiar with the concept of writing the pseudocode ? Try to see if you can translate the text to pseudocode: https://www.wikihow.com/Write-Pseudocode

If not, don't worry about it, this is good enough. I will answer questions later, when available.

damirsaleschoice commented 3 years ago

PR:

  1. OK
  2. OK
  3. OK
  4. We can always have the first selected by default, or we can simply unselect all and then not allow "next" unless one emotion is selected. Radio selections allow only one select.
  5. There is no "Back" only "Next"
  6. OK
  7. Training should happen per document upload.
sherlockliang888 commented 3 years ago

1. Store input text as a variable with key:

06091000: {text_ there is some texts}

If Input Textarea is not empty: 
   Record the current timestamp as the key
   Save the input as a variable so that referring to key is equivalent to referring the text
   variable = Text2backend(variable)
   Print( EmotionDetecter(variable)[0] 
Else:
   Prompt asking for user input

2. EmotionDetector(variable), this functions reads the variable in backend, read the most recent model saved and performs an analysis, return an emotion: The input should be a string, in this case some texts. The returned variable should be stored as result1, which is a string inside of a list, like ["surprised"]

3. Text2backend(variable): Send text to backend, this functions sends the variable to backend, and returns the variable name.

4. Textlabel2backend(variable): Send text with label, which should be a dictionary, to backend, returns None.

5. Train_all(): Training all text with all labels in the backend, save the model, returns None. Read all text and apply filter (remove stopwords, word2vec etc) Apply algorithms and train the model Save the model

6. User choose whether they are satisfied with the emotion result with radio buttons (first selected by default):

Example for "yes":

06091000: {text: "there is some texts", result: ["surprised", "surprised"][1]}

If "yes" is checked:
Duplicate the result1 and append to the list so that the list has 2 identical strings
Textlabel2backend(variable)  --> Send result to backend for storage/training
Return to Homepage 
Else if "no" is checked:
Hide this current section 
Show "Correction" Section

7. User choose the correct emotion (first selected by default):

Example for "happy" selected:

06091000: {text: "there is some texts", result: ["surprised", "happy"][1]}

If "happy" is checked:
   Append result1 with "happy" 
   Textlabel2backend(variable)  --> Send result to backend for storage/training
   Train_all() to train and save the model for prediction next time 
   Return to Homepage
Else if "sad" is checked:
   Append result1 with "sad" 
   Textlabel2backend(variable)  --> Send result to backend for storage/training
   Train_all() to train and save the model for prediction next time 
   Return to Homepage
Else if ...
   End

Needs PR (I will add more if I can come up with more)

damirsaleschoice commented 3 years ago

Thank you, I will review it as soon as I am done with one very important task I am doing now.

sherlockliang888 commented 3 years ago

Thanks, please take your time, I will go work on other tasks.

damirsaleschoice commented 3 years ago

Great work, this is exactly what we want !