Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1001930 // feedbackScore - parse NL feedback

JavaX fragment (include)

1  
static int feedbackScore(S s) {
2  
  s = dropWords(s, "bot");
3  
  s = dropPunctuation(s);
4  
  L<S> tok = nlTok(s);
5  
  if (l(tok) != 3) ret 0;
6  
  S word = tok.get(1).toLowerCase();
7  
  word = collapseWord(word);
8  
  if (litlist("nice", "god" /* matches both "god" and "good" :) */, "ok", "corect", "right", "true", "yes", "col" /* cool */).contains(word))
9  
    ret 1;
10  
  if (litlist("no", "wrong", "bad").contains(word))
11  
    ret -1;
12  
  ret 0;
13  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001930
Snippet name: feedbackScore - parse NL feedback
Eternal ID of this version: #1001930/1
Text MD5: 21f35221efc43e91741b70d28a2724c3
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-08 18:03:56
Source code size: 439 bytes / 13 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 569 / 1121
Referenced in: [show references]