-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto moderation feature #3
Comments
Hi, I just had a couple of questions as I am not too familiar with the NextJS and React and am not sure exactly what part of the site this issue pertains to:
Also, what sort of content will be inputted? I was thinking if it is comments on a web page for example, I could scan for key words - but what content is considered 'good'? |
Hi, Apologies for the late post, I'm not sure exactly what section of the website this section pertains to so I will paste my function here. I have provided a basic framework in JavaScript to determine if a passage of text is good or bad (function will return
-- Jai |
Nice work man you can create a new file and put this code there anyone who
will need it can use it. If you want to improve your code I would suggest
you take a look at regex, map and filter functions and taking the replace
functions outside the second loop.
On Sun, 28 Jul 2019 at 9:57 pm, Jai Castle ***@***.***> wrote:
Hi, Apologies for the late post, I'm not sure exactly what section of the
website this section pertains to so I will paste my function here. I have
provided a basic framework in JavaScript to determine if a passage of text
is good or bad (function will return true or false). Please let me know
if there is anything I can do towards producing a 0-100 scale as I am
unsure of the context.
function Moderation_isAcceptablePassage(inputText) {
var wordsNotAllowed = ['badWord1', 'badWord2'] ; // Change these to the list of words not allowed
var words = inputText.split(' ');
for (var i=0; i<words.length; i=i+1) {
for (var j = 0; j <wordsNotAllowed.length ; j = j + 1) {
var currentWord = words[i].replace('.','');
currentWord = currentWord.replace('_', '');
currentWord = currentWord.replace('*', '');
currentWord = currentWord.replace('!', '');
currentWord = currentWord.replace('?', '');
if (currentWord.localeCompare(wordsNotAllowed[j]) == 0) {
return false;
}
}
}
return true;
}
- Jai
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3?email_source=notifications&email_token=AFRBXUAG5MRWPTJT5YC4TMTQBWQV5A5CNFSM4H27PP3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD267G4Y#issuecomment-515765107>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFRBXUEIXKXLGI3KEKJNZF3QBWQV5ANCNFSM4H27PP3A>
.
--
Regards,
David
|
A function(s) that with given text input can determine if the content is good or bad or places it on some sort of scale 0-100.
The text was updated successfully, but these errors were encountered: