This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function comment_toxicity() | |
{ | |
$options = get_option( 'settingsToxic' ); | |
$threshold = $options['threshold']/100; | |
if(is_single() && comments_open() && isset($options['toxicdetection']) ) { | |
?> | |
<script> | |
window.onload=function() { | |
var commentForm = document.getElementById('commentform'); | |
commentForm.addEventListener('submit', function(event){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use provider GithubPlatform.GithubWebhookEventProvider | |
on event Star_Created do | |
action SlackPlatform.PostMessage(message : ":tada: New star on <" + context(star).get("repository->html_url") + " | " + context(star).get("repository->name") + "> by <" + context(star).get("sender->html_url") + " | " + context(star).get("sender->login") + "> :confetti_ball:\nCurrent stargazers count: " + context(star).get("repository->stargazers_count") + ":clap::champagne:", channel : config(slack.channel)) | |
on event Star_Deleted do | |
action SlackPlatform.PostMessage(message : ":sob: <" + context(star).get("sender->html_url") + " | " + context(star).get("sender->login") + "> unstarred <" + context(star).get("repository->html_url") + " | " + context(star).get("repository->name") + "> :face_with_head_bandage: let's forget about it and build awesome features! :kissing_heart:\nCurrent stargazer count: " + context(star).get("repository->stargazers_count") + ":stars:", channel : config(slack.channel)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on intent Welcome do | |
switch(value : Math.random) { | |
case value <= 0.25 : ChatPlatform.Reply("Hi") | |
case value <= 0.5 && value > 0.25 : ChatPlatform.Reply("Hello") | |
case value <= 0.75 && value > 0.5 : ChatPlatform.Reply("Hi, nice to meet you!") | |
case value <= 1 && value > 0.75 : ChatPlatform.Reply("Greetings") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on intent Default_Fallback_Intent from ReactPlatform do | |
val reactChannel = context.get("chat").get("channel") as String | |
var reactSlackMap = session.get("react-slack-map") as com.google.common.collect.BiMap<String, String> | |
if(reactSlackMap === null) { | |
reactSlackMap = com.google.common.collect.HashBiMap.<String, String>create | |
session.put("react-slack-map", reactSlackMap) | |
} | |
val storedSlackTs = reactSlackMap.get(reactChannel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on intent Default_Fallback_Intent from SlackPlatform do | |
val reactSlackMap = session.get("react-slack-map") as com.google.common.collect.BiMap<String, String> | |
if(reactSlackMap !== null) { | |
val slackTs = context.get("slack").get("threadTs") as String | |
val reactChannel = reactSlackMap.inverse.get(slackTs) | |
if(reactChannel === null) { | |
if(slackTs.empty) { | |
/* | |
* No threadTs means we are in the top-level conversation | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public RecognizedIntent process(RecognizedIntent recognizedIntent, XatkitSession session) { | |
session.getRuntimeContexts().setContextValue(NLP_CONTEXT_KEY, 1, SENTIMENT_PARAMETER_KEY, | |
DEFAULT_SENTIMENT_VALUE); | |
Annotation annotation = getAnnotation(recognizedIntent.getMatchedInput(), session); | |
List<CoreMap> sentenceAnnotations = annotation.get(CoreAnnotations.SentencesAnnotation.class); | |
String sentimentValue = | |
sentenceAnnotations.get(sentenceAnnotations.size() - 1).get(SentimentCoreAnnotations.SentimentClass.class); | |
session.getRuntimeContexts().setContextValue(NLP_CONTEXT_KEY, 1, SENTIMENT_PARAMETER_KEY, sentimentValue); | |
return recognizedIntent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected final Annotation getAnnotation(String input, XatkitSession session) { | |
String nlpInput = (String) session.get(NLP_INPUT_SESSION_KEY); | |
Annotation annotation = (Annotation) session.get(NLP_ANNOTATION_SESSION_KEY); | |
if (isNull(annotation) || isNull(nlpInput) || !nlpInput.equals(input)) { | |
Log.debug("There is no annotation for \"{0}\" in the session, computing the annotation with {1}", input, | |
StanfordNLPService.class.getSimpleName()); | |
annotation = StanfordNLPService.getInstance().annotate(input); | |
session.store(NLP_INPUT_SESSION_KEY, input); | |
session.store(NLP_ANNOTATION_SESSION_KEY, annotation); | |
} else { |
OlderNewer