cancel
Showing results for 
Search instead for 
Did you mean: 

i made a sarcasm detector in python 3

hoppingbunny123
Rising Star

the code is in github here is the video of the code and a demo;

 

https://youtu.be/i1lnN1tIFg0

 

GitHub - dothehokiepokie/mystuffyouknow: my stuff

 

i read about darpa making a sarcasm detector so i tried today too.

29 REPLIES 29

hoppingbunny123
Rising Star

i updated the code to format the input string. here's the output;

 

input = revenge is a dish best served cold
these are the overlapping sarcastic letters: {'a', 'd', 's', 'e', 'v'}
e
v
"revenge" has this many matching sarcastic letter 2
s
"is" has this many matching sarcastic letter 1
a
"a" has this many matching sarcastic letter 1
d
s
"dish" has this many matching sarcastic letter 2
s
e
"best" has this many matching sarcastic letter 2
d
s
e
v
"served" has this many matching sarcastic letter 4
d
"cold" has this many matching sarcastic letter 1

[Done] exited with code=0 in 0.075 seconds

 

input = I'm a little tea pot!
these are the overlapping sarcastic letters: {'e', 'a', 'o', 't', 'l'}
"im" has this many matching sarcastic letter 0
a
"a" has this many matching sarcastic letter 1
e
t
l
"little" has this many matching sarcastic letter 3
e
a
t
"tea" has this many matching sarcastic letter 3
o
t
"pot" has this many matching sarcastic letter 2

[Done] exited with code=0 in 0.055 seconds

hoppingbunny123
Rising Star

here's some more examples:

 

input = We just have to troll harder
these are the overlapping sarcastic letters: {'r', 't', 'o'}
"we" has this many matching sarcastic letter 0
t
"just" has this many matching sarcastic letter 1
"have" has this many matching sarcastic letter 0
t
o
"to" has this many matching sarcastic letter 2
r
t
o
"troll" has this many matching sarcastic letter 3
r
"harder" has this many matching sarcastic letter 1

[Done] exited with code=0 in 0.054 seconds

 

input = This is totally going to work perfectly.
these are the overlapping sarcastic letters: {'o', 'e', 'r', 'g', 'a', 't', 'i'}
t
i
"this" has this many matching sarcastic letter 2
i
"is" has this many matching sarcastic letter 1
o
a
t
"totally" has this many matching sarcastic letter 3
o
g
i
"going" has this many matching sarcastic letter 3
o
t
"to" has this many matching sarcastic letter 2
o
r
"work" has this many matching sarcastic letter 2
e
r
t
"perfectly" has this many matching sarcastic letter 3

[Done] exited with code=0 in 0.055 seconds

 

input = Another great use of our tax dollars by DARPA.
these are the overlapping sarcastic letters: {'a', 'r', 'u', 's', 'e', 'l', 't'}
a
r
e
t
"another" has this many matching sarcastic letter 4
a
r
e
t
"great" has this many matching sarcastic letter 4
u
s
e
"use" has this many matching sarcastic letter 3
"of" has this many matching sarcastic letter 0
r
u
"our" has this many matching sarcastic letter 2
a
t
"tax" has this many matching sarcastic letter 2
a
r
s
l
"dollars" has this many matching sarcastic letter 4
"by" has this many matching sarcastic letter 0
a
r
"darpa" has this many matching sarcastic letter 2

[Done] exited with code=0 in 0.054 seconds

 

input = Someone run this comment through the sarcasm detector.
these are the overlapping sarcastic letters: {'a', 'u', 'o', 'm', 'r', 'h', 's', 'c', 'e', 't'}
o
m
s
e
"someone" has this many matching sarcastic letter 4
u
r
"run" has this many matching sarcastic letter 2
h
s
t
"this" has this many matching sarcastic letter 3
o
m
c
e
t
"comment" has this many matching sarcastic letter 5
u
o
r
h
t
"through" has this many matching sarcastic letter 5
h
e
t
"the" has this many matching sarcastic letter 3
a
m
r
s
c
"sarcasm" has this many matching sarcastic letter 5
o
r
c
e
t
"detector" has this many matching sarcastic letter 5

[Done] exited with code=0 in 0.055 seconds

 

input = That's just great.
these are the overlapping sarcastic letters: {'t', 'e', 'a'}
t
a
"thats" has this many matching sarcastic letter 2
t
"just" has this many matching sarcastic letter 1
t
e
a
"great" has this many matching sarcastic letter 3

[Done] exited with code=0 in 0.056 seconds

 

input = God help us.
these are the overlapping sarcastic letters: {'o'}
o
"god" has this many matching sarcastic letter 1
"help" has this many matching sarcastic letter 0
"us" has this many matching sarcastic letter 0

[Done] exited with code=0 in 0.054 seconds

hoppingbunny123
Rising Star

i have an idea, that the number of letters in a word fit together with the number of letters in another word to form a pair that is then met with a string of words where the number of letters in the string matter logically.

 

first the pair. there is a larger word followed by a smaller word.

 

the pair is followed by a string of words that eventually changes into a pair, the pair being a large and a small word.

 

how this looks, is the first pair is a large and small word, there is a string that follows, and in the string is another large and small word.

 

the way the two pairs fit together is to form a thought, where the first pair is the noun, the second pair is what the noun does or the verb.

 

and also, if the string has no large and small pair, it is a small and smaller pair that still functions as a pair but equal to a binary 0 pair. this means the action is negative or zero.

 

else, the following string pair is a large and small word fit together and this is a binary 1 pair. binary 1 is good. binary 0 is bad.

 

so if you have a bad binary then your bad, or the noun word pair is bad rather.

hoppingbunny123
Rising Star

i watched a few youtube videos, one where a person said "negative responses rise faster", and another said that videogames like call of duty have an algorithm that makes people lose or win.

 

the way this functions on my previous posts logic is the way the two people talk to each other, one person presents the subject with the large and small words, the next person presents what the subject does with no real difference in the size of the words and they are all small words in comparison to the subject big word.

 

to command the direction of the conversation is empowering. so the person who mentions the subject set of words controls the conversation.

 

how this translates to the logic i mentioned is the negative response is not commanding the direction of the conversation or the way the game is won or lost.

 

i believe after watching video games a algorithm like the one i mentioned in my previous post already exists and is used to control video games and also social media. its also conversational ai if you think about it way beyond microsoft tay.

 

 

hoppingbunny123
Rising Star

to follow up my previous post where there is 1 person who makes the pair thats the topic or the subject of the conversation, then the other person has the option to become submissive and then present a response thats (negative or not active) or (positive and active).

 

then from this you deduce that if the person is not submissive when they respond, they present their own subject pair, then here is the point or logical deduction, the person presented with the subject pair has the option to one: be submissive, two: be negative.

 

then taking advantage of the situation that presents itself make the negative go in a derogatory direction. derogatory is negative also, and presents itself as passive or non-active while taking advantage of the opportunity to direct the conversation to a derogatory conclusion.

 

so for logic to be good or active, active being equivalent to directing the conversation, when presented with the opportunity to direct the conversation, if your not happy if the conversation becomes derogatory, then do not take advantage of the opportunity to direct the conversation but remain passive and non-active. letting the other person be the parent while you remain the child.

Zenbane
MVP
MVP

I saw the code. It does not detect sarcasm. It simply checks to see which letters overlap between words. That's not sarcasm, bro. That's just matching pairs.

 

That would be like me saying that I have discovered the formula that explains the birth of the Cosmos.... behold:

X = Y

 

hoppingbunny123
Rising Star

i will run the text of your post through the program and see if the higher values show sarcasm. let the program speak for itself. i assume you didn't try the program yourself and look for hints of sarcasm in the results instead you just deduced the program results.

 

these are the overlapping sarcastic letters: {'i', 't', 'w', 'd', 'u', 'p', 'h', 'y', 'r', 'v', 'x', 'n', 'e', 'c', 's', 'l', 'f', 'a', 'o', 'm'}
i
"i" has this many matching sarcastic letter 1
w
s
a
"saw" has this many matching sarcastic letter 3
t
h
e
"the" has this many matching sarcastic letter 3
d
e
c
o
"code" has this many matching sarcastic letter 4
i
t
"it" has this many matching sarcastic letter 2
d
e
s
o
"does" has this many matching sarcastic letter 4
t
n
o
"not" has this many matching sarcastic letter 3
t
d
e
c
"detect" has this many matching sarcastic letter 4
r
c
s
a
m
"sarcasm" has this many matching sarcastic letter 5
i
t
"it" has this many matching sarcastic letter 2
i
p
y
s
l
m
"simply" has this many matching sarcastic letter 6
h
e
c
s
"checks" has this many matching sarcastic letter 4
t
o
"to" has this many matching sarcastic letter 2
e
s
"see" has this many matching sarcastic letter 2
i
w
h
c
"which" has this many matching sarcastic letter 4
t
r
e
s
l
"letters" has this many matching sarcastic letter 5
p
r
v
e
l
a
o
"overlap" has this many matching sarcastic letter 7
t
w
n
e
"between" has this many matching sarcastic letter 4
w
d
r
s
o
"words" has this many matching sarcastic letter 5
t
h
s
a
"thats" has this many matching sarcastic letter 4
t
n
o
"not" has this many matching sarcastic letter 3
r
c
s
a
m
"sarcasm" has this many matching sarcastic letter 5
r
o
"bro" has this many matching sarcastic letter 2
t
h
s
a
"thats" has this many matching sarcastic letter 4
t
u
s
"just" has this many matching sarcastic letter 3
i
t
h
n
c
a
m
"matching" has this many matching sarcastic letter 7
i
p
r
s
a
"pairs" has this many matching sarcastic letter 5
t
h
a
"that" has this many matching sarcastic letter 3
w
d
u
l
o
"would" has this many matching sarcastic letter 5
e
"be" has this many matching sarcastic letter 1
i
e
l
"like" has this many matching sarcastic letter 3
e
m
"me" has this many matching sarcastic letter 2
i
y
n
s
a
"saying" has this many matching sarcastic letter 5
t
h
a
"that" has this many matching sarcastic letter 3
i
"i" has this many matching sarcastic letter 1
h
v
e
a
"have" has this many matching sarcastic letter 4
i
d
r
v
e
c
s
o
"discovered" has this many matching sarcastic letter 8
t
h
e
"the" has this many matching sarcastic letter 3
u
r
l
f
a
o
m
"formula" has this many matching sarcastic letter 7
t
h
a
"that" has this many matching sarcastic letter 3
i
p
x
n
e
s
l
a
"explains" has this many matching sarcastic letter 8
t
h
e
"the" has this many matching sarcastic letter 3
i
t
h
r
"birth" has this many matching sarcastic letter 4
f
o
"of" has this many matching sarcastic letter 2
t
h
e
"the" has this many matching sarcastic letter 3
c
s
o
m
"cosmos" has this many matching sarcastic letter 4
d
h
e
l
o
"behold" has this many matching sarcastic letter 5
x
"x" has this many matching sarcastic letter 1
"" has this many matching sarcastic letter 0
y
"y" has this many matching sarcastic letter 1

[Done] exited with code=0 in 0.074 seconds
 
if we look at the scientific formula first you see something next you prove it. if you don't see something and you don't prove it how is that scientific its pseudo bs.


@hoppingbunny123 wrote:

i assume you didn't try the program yourself and look for hints of sarcasm in the results instead you just deduced the program results.


 

I read the code line by line, and it is very simplistic. You are simply using Substring to find matching letters. This could have been achieved in significantly less code. At no point does your code look for "sarcasm."

 

Your code is only looking for letters  by asking questions like, "Is the letter E found in the word LETTER."

 

It's not even really "detecting" anything, if we're being honest. Matching pairs isn't detection.

 

hoppingbunny123
Rising Star

The basic problem is the scientific method needs you to see something to prove methodically.

 

Since you don't see what I see you can't prove it scientifically. So there is nothing to prove or disprove. With you.