I used the free google translate API to make a translation command for nightbot. The problem is the occasional times where someone writes something well outside ToS or channel-rules in another language and we then end up translating it.
Logical solution is to pass the text through a profanity-filter after translation to english.
I’ve found a good API for this but the problem I’m having is how do I pass the translated text (so a variable) to the next urlfetch?
If I do :
$(eval translated=$(urlfetch [translationAPI]&q="$(querystring)"); profanity=$(urlfetch [filterAPI]&q="translated"))
It obviously doesn’t recognize the variable im trying to pass to the 2nd urlfetch and just checks the string “translated” for profanity.
I also tried nesting the translateAPI within the filterAPI like this:
$(eval profanity=$(urlfetch [filterAPI]&q="$(urlfetch [translationAPI]&q='$(querystring)')"))
but then it doesn’t want to acknowledge the fact that querystring is a variable…
Anyone have any ideas/solutions? Technically i could just have an array of profanity in the eval that I compare the translated text to, but that’s far less accurate then some of the good APIs.