コード例 #1
0
ファイル: rereversei.py プロジェクト: blackxspade/sugaroid
    def process(self,
                statement,
                additional_response_selection_parameters=None):
        _ = normalize
        emotion = Emotion.neutral
        self.normalized = normalize(str(statement))
        if self.chatbot.globals["reversei"]["type"] is str:
            ordinal_statement = str(statement).replace("9th", "ninth")
            # FIXME PORT RO
            if (cosine_similarity(_(ordinal_statement),
                                  _(self.chatbot.globals["reversei"]["uid"])) >
                    0.8):
                response = "Exactly, you got it right!"
                emotion = Emotion.positive
                reset_reverse(self)
            else:
                response = "Close! it was {}".format(
                    self.chatbot.globals["reversei"]["uid"])
                emotion = Emotion.lol
                reset_reverse(self)
            confidence = 0.99
        elif self.chatbot.globals["reversei"]["type"] is bool:

            if self.chatbot.globals["reversei"]["uid"] == 30000000001:
                """
                NameAdapter: token 30000000001
                """
                if ("yes" in self.normalized) or ("yea" in self.normalized):
                    response = "Ok, will keep that in mind!"
                    self.chatbot.globals["USERNAME"] = self.chatbot.globals[
                        "nn"]
                    self.chatbot.globals["nn"] = None
                    reset_reverse(self)
                else:
                    response = "Ok, I guess I am smart"
                    emotion = Emotion.wink
                    reset_reverse(self)
                confidence = 1.0
            else:
                if ("yes" in self.normalized) or ("yea" in self.normalized):
                    if len(self.chatbot.globals["history"]["total"]) > 1:
                        if "joke" in _(
                                str(self.chatbot.globals["history"]["total"]
                                    [-1])):
                            joke = pyjokes.get_joke("en", "all")
                            selected_statement = SugaroidStatement(
                                joke, chatbot=True)
                            selected_statement.emotion = Emotion.lol
                            selected_statement.confidence = 0.95
                            return selected_statement

                        else:
                            # TODO: Not Implemented yet
                            response = "Ok. (# Not Implemented yet. LOL)"
                else:
                    response = "Ok then, probably next time"
                    reset_reverse(self)
                confidence = 1.0
        elif self.chatbot.globals["reversei"]["type"] is None and (
                not self.chatbot.globals["reversei"]["uid"] == "CORONAVIRUS"):
            fname = False
            name = difference(self.normalized,
                              ["my", "name", "is", "good", "be"])
            tokenized = nltk.pos_tag(name)
            for i in tokenized:
                if i[1] == "NN":
                    fname = i[0]
                    break
            if fname:
                response = "Nice to meet you {}".format(fname)
                emotion = Emotion.positive
                reset_reverse(self)
            else:
                response = "I couldn't find your name. 🥦"
                emotion = Emotion.non_expressive_left
                reset_reverse(self)
            confidence = 1
        elif self.chatbot.globals["reversei"]["type"] is int:
            confidence = (
                2.0  # FIXME: Override Mathematical Evaluation when not necessary
            )

            if self.chatbot.globals["reversei"]["uid"] == 30000000002:
                """
                WikiAdapter: token 30000000002
                """
                if ("yes" in self.normalized) or ("yea" in self.normalized):
                    response = "I thought you would tell me a number to choose from :/"
                    emotion = Emotion.seriously

                elif ("no" in self.normalized) or ("no" in self.normalized):
                    response = ("Oops! Sorry about that, seems like what "
                                "your'e searching for is not on Wikipedia yet")
                    emotion = Emotion.dead
                    reset_reverse(self)
                else:
                    chatbot_temporary_data = self.chatbot.globals["temp_data"]
                    tokenized = nltk.pos_tag(tokenize(str(statement)))
                    for i in tokenized:
                        if i[1] == "CD":
                            try:
                                num = int(i[0])
                            except ValueError:
                                num = text2int(i[0].lower())
                            index = num - 1
                            if index < len(chatbot_temporary_data):
                                response, confidence, stat = wikipedia_search(
                                    self, chatbot_temporary_data[index])
                                logging.info("REVERSEI: {}".format(response))
                                confidence = (
                                    1 + confidence
                                )  # FIXME override math evaluation adapter
                                if not stat:
                                    response = (
                                        "I have some trouble connecting"
                                        "to Wikipedia. Something's not right")
                                    confidence = 1.1

                                emotion = Emotion.rich
                                reset_reverse(self)
                                break
                            else:
                                response = "Sorry, I couldn't find the item you were choosing. "
                                confidence = 1.1
                                emotion = Emotion.cry_overflow
                                reset_reverse(self)
                                break
                    else:
                        response = (
                            "I thought you wanted to know something from wikipedia. "
                            "Ok, I will try something else")
                        emotion = Emotion.seriously
                        reset_reverse(self)
                        confidence = 1.2
        else:
            if self.chatbot.globals["reversei"]["uid"] == "CORONAVIRUS":
                confidence = 1
                NUM = self.chatbot.globals["reversei"]["data"][0]

                score = self.chatbot.globals["reversei"]["data"][1]
                if NUM == 6:
                    self.chatbot.globals["reversei"]["enabled"] = False
                    if score > 3:
                        response = "You have a high risk of COVID-19"
                    else:
                        response = "As per my approximation, you do not have a high risk of COVID-19"
                    response += (
                        "\n My approximations might not be correct. "
                        "You might confirm my results by a legal test")
                else:
                    sia = SentimentIntensityAnalyzer()
                    _scores = sia.polarity_scores(str(statement))
                    true_responses = ["yes", "yea", "y", "yup", "true"]
                    if (any_in(
                            true_responses +
                        [x.capitalize() for x in true_responses],
                            self.normalized,
                    ) or (_scores["pos"] > _scores["neg"])):
                        score += COVID_QUESTIONS[NUM - 1][2]
                    response = COVID_QUESTIONS[NUM][1]

                    self.chatbot.globals["reversei"]["data"] = [NUM + 1, score]

            else:
                response = "ok"

                confidence = 0

        selected_statement = SugaroidStatement(response, chatbot=True)
        selected_statement.confidence = confidence

        selected_statement.emotion = emotion

        return selected_statement
コード例 #2
0
    def process(self, statement, additional_response_selection_parameters=None):
        response = "ok"
        confidence = 0
        emotion = Emotion.neutral
        if raw_in("I", self.tokenized):
            logging.info(
                str(["{} {} {}".format(k, k.tag_, k.pos_) for k in self.tokenized])
            )
            # check if the pronoun has been reached yet, otherwise may detect some other nouns
            start_scanning = False
            for i in self.tokenized:
                if i.pos_ == "PRON" and not i.tag_.startswith("W"):
                    start_scanning = True
                if start_scanning:
                    pass
                elif (
                    (i.pos_ != "PRON")
                    or (not start_scanning)
                    or (i.tag_.startswith("W"))
                ):
                    logging.info("MeAdapter: Skipping {} {}".format(i.lower_, i.tag_))
                    continue
                logging.info("MeAdapter: Scanning :: {} : {}".format(i.text, i.pos_))
                if (i.pos_ == "PROPN") or (i.tag_ == "NN"):
                    nn = i.text
                    if self.chatbot.globals["USERNAME"]:
                        response = (
                            "Are you sure you are {n}? I thought you were {u}".format(
                                n=nn, u=self.chatbot.globals["USERNAME"]
                            )
                        )
                        emotion = Emotion.wink
                        if i.pos_ == "PROPN":
                            confidence = 0.95
                        else:
                            confidence = 0.8
                        self.chatbot.globals["nn"] = nn
                        self.chatbot.globals["reversei"]["uid"] = 30000000001
                        self.chatbot.globals["reversei"]["type"] = bool
                        self.chatbot.globals["reversei"]["enabled"] = True
                        emotion = Emotion.non_expressive_left
                        break
                    else:
                        if not ("not" in str(statement)):
                            if i.lower_ == "sugaroid":
                                response = random_response(I_AM)
                                emotion = Emotion.lol
                                confidence = 0.95
                            else:
                                response = random_response(GREET).format(
                                    str(nn).capitalize()
                                )
                                confidence = 0.9
                                self.chatbot.globals["USERNAME"] = nn
                                emotion = Emotion.positive
                            break
                        else:
                            response = "Ok!"
                            confidence = 0.5
                            emotion = Emotion.seriously
                            break
                elif i.lower_ == "sugaroid":
                    response = random_response(I_AM)
                    emotion = Emotion.lol
                    confidence = 0.95
                else:
                    sia = SentimentIntensityAnalyzer()
                    ps = sia.polarity_scores(str(i.sent))
                    confidence = 0.35
                    if ps["neu"] == 1:
                        response = "Ok! Thats great to hear from you"
                        emotion = Emotion.lol
                    elif ps["pos"] > ps["neg"]:
                        response = "Yay! I agree to you"
                        emotion = Emotion.positive
                    else:
                        confidence = 0.2
                        response = "Think again"
                        emotion = Emotion.non_expressive_left
        elif raw_lower_in("you", self.tokenized):
            logging.info(
                str(["{} {} {}".format(k, k.tag_, k.pos_) for k in self.tokenized])
            )
            nn = ""
            start_scanning = False
            for i in self.tokenized:
                if i.pos_ == "PRON" and not i.tag_.startswith("W"):
                    start_scanning = True
                if start_scanning:
                    pass
                elif (
                    (i.pos_ != "PRON")
                    or (not start_scanning)
                    or (i.tag_.startswith("W"))
                ):
                    logging.info(
                        "MeAdapter: Skipping {} {} ss={} {}".format(
                            i.lower_, i.tag_, not start_scanning, i.pos_
                        )
                    )
                    continue
                logging.info("MeAdapter: Scanning :: {} : {}".format(i.text, i.pos_))
                if i.pos_ == "ADJ":
                    try:
                        cos = cosine_similarity([str(i.lower_)], ["sugaroid"])
                    except ZeroDivisionError:
                        cos = 0.0
                    if i.lower_ == "sugaroid":
                        nn = i.text
                        response = "Yup, that's my name. I am sugaroid"
                        emotion = Emotion.lol
                        confidence = 0.9
                        break
                    elif cos > 0.9:
                        response = "Yes, you were close! My name is sugaroid"
                        emotion = Emotion.positive
                        confidence = 0.9
                        break
                    else:
                        if i.lower_ in ["human", "animal", "bird"]:
                            response = "No, I am not a {adj}. I am a robot".format(
                                adj=i.lower_
                            )
                            emotion = Emotion.angry_non_expressive
                            confidence = 0.9
                        else:
                            response = "seriously?"
                            emotion = Emotion.angry
                            confidence = 0.09

                elif i.pos_ == "PROPN":
                    cos = cosine_similarity([str(i.lower_)], ["sugaroid"])

                    if i.lower_ == "sugaroid":
                        nn = i.text
                        response = "Yup, that's my name. I am sugaroid"
                        emotion = Emotion.lol
                        confidence = 0.9
                        break
                    elif cos > 0.9:
                        response = "Yes, you were close! My name is sugaroid"
                        emotion = Emotion.positive
                        confidence = 0.9
                        break
                    elif i.lower_ in WHAT_I_AM_GOING_TO_DO:
                        confidence = 0.4
                        response = "Perhaps, I will sit simply, and smile."
                        emotion = Emotion.lol
                    else:
                        nn = i.text
                        response = "Nope, I am not {n}, I am sugaroid".format(n=nn)
                        emotion = Emotion.angry
                        confidence = 0.9

                elif i.tag_ == "NN":
                    if i.lower_ in ["bot", "robot", "computer", "silicon", "infant"]:
                        response = "You are right! I am a {}".format(i.lower_)
                        confidence = 0.9
                        emotion = Emotion.positive
                    elif i.lower_ in [
                        "human",
                        "bird",
                        "animal",
                        "tree",
                        "politician",
                        "player",
                        "liar",
                        "priest",
                    ]:
                        response = "No way! I can't imagine myself to be a {}".format(
                            i.lower_
                        )
                        confidence = 0.9
                        emotion = Emotion.vomit
                    else:
                        logging.info(
                            "MeAdapter: Couldn't classify type of noun {}".format(
                                i.lower_
                            )
                        )
                        confidence = 0.9
                        sia = SentimentIntensityAnalyzer()
                        ps = sia.polarity_scores(str(i.sent))
                        if ps["neu"] == 1.0:
                            # try presence adapter pieces
                            presence_statement = process_what_ami_doing(statement)
                            if presence_statement.confidence == 0:

                                response = (
                                    "I will need more time to learn if that actually makes sense with respect to "
                                    "myself. "
                                )
                                emotion = Emotion.cry
                            else:
                                return presence_statement
                        elif ps["pos"] > ps["neg"]:
                            response = "I guess I am {}. Thanks!".format(i.text)
                            emotion = Emotion.wink
                        else:
                            response = "I am not {}! I am Sugaroid.".format(i.lower_)
                            emotion = Emotion.angry

                elif i.tag_.startswith("VB"):
                    root_verb = i.lemma_
                    if root_verb in [
                        "say",
                        "tell",
                        "speak",
                        "murmur",
                        "blabber",
                        "flirt",
                    ]:
                        response = random_response(BURN_IDK)
                        emotion = Emotion.lol
                        confidence = 0.8

        else:
            presence_statement = process_what_ami_doing(statement)
            if presence_statement.confidence == 0:
                # FIXME : Add more logic here
                response = "Ok"
                confidence = 0.05
                emotion = Emotion.non_expressive_left
            else:
                return presence_statement

        selected_statement = SugaroidStatement(response, chatbot=True)
        selected_statement.confidence = confidence
        selected_statement.emotion = emotion
        return selected_statement
コード例 #3
0
    def process(self,
                statement,
                additional_response_selection_parameters=None):
        response = 'ok'
        confidence = 0
        emotion = Emotion.neutral
        if raw_in('I', self.tokenized):
            logging.info(
                str([
                    "{} {} {}".format(k, k.tag_, k.pos_)
                    for k in self.tokenized
                ]))
            # check if the pronoun has been reached yet, otherwise may detect some other nouns
            start_scanning = False
            for i in self.tokenized:
                if i.pos_ == 'PRON' and not i.tag_.startswith("W"):
                    start_scanning = True
                if start_scanning:
                    pass
                elif (i.pos_ != 'PRON') or (not start_scanning) or (
                        i.tag_.startswith('W')):
                    logging.info("MeAdapter: Skipping {} {}".format(
                        i.lower_, i.tag_))
                    continue
                logging.info("MeAdapter: Scanning :: {} : {}".format(
                    i.text, i.pos_))
                if (i.pos_ == 'PROPN') or (i.tag_ == 'NN'):
                    nn = i.text
                    if self.chatbot.globals['USERNAME']:
                        response = "Are you sure you are {n}? I thought you were {u}".format(
                            n=nn, u=self.chatbot.globals['USERNAME'])
                        emotion = Emotion.wink
                        if i.pos_ == 'PROPN':
                            confidence = 0.95
                        else:
                            confidence = 0.8
                        self.chatbot.globals['nn'] = nn
                        self.chatbot.globals['reversei']['uid'] = 30000000001
                        self.chatbot.globals['reversei']['type'] = bool
                        self.chatbot.globals['reversei']['enabled'] = True
                        emotion = Emotion.non_expressive_left
                        break
                    else:
                        if not ('not' in str(statement)):
                            if i.lower_ == 'sugaroid':
                                response = random_response(I_AM)
                                emotion = Emotion.lol
                                confidence = 0.95
                            else:
                                response = random_response(GREET).format(
                                    str(nn).capitalize())
                                confidence = 0.9
                                self.chatbot.globals['USERNAME'] = nn
                                emotion = Emotion.positive
                            break
                        else:
                            response = 'Ok!'
                            confidence = 0.5
                            emotion = Emotion.seriously
                            break
                elif i.lower_ == 'sugaroid':
                    response = random_response(I_AM)
                    emotion = Emotion.lol
                    confidence = 0.95
                else:
                    sia = SentimentIntensityAnalyzer()
                    ps = sia.polarity_scores(str(i.sent))
                    confidence = 0.35
                    if ps['neu'] == 1:
                        response = 'Ok! Thats great to hear from you'
                        emotion = Emotion.lol
                    elif ps['pos'] > ps['neg']:
                        response = 'Yay! I agree to you'
                        emotion = Emotion.positive
                    else:
                        confidence = 0.2
                        response = 'Think again'
                        emotion = Emotion.non_expressive_left
        elif raw_lower_in('you', self.tokenized):
            logging.info(
                str([
                    "{} {} {}".format(k, k.tag_, k.pos_)
                    for k in self.tokenized
                ]))
            nn = ''
            start_scanning = False
            for i in self.tokenized:
                if i.pos_ == 'PRON' and not i.tag_.startswith("W"):
                    start_scanning = True
                if start_scanning:
                    pass
                elif (i.pos_ != 'PRON') or (not start_scanning) or (
                        i.tag_.startswith('W')):
                    logging.info("MeAdapter: Skipping {} {} ss={} {}".format(
                        i.lower_, i.tag_, not start_scanning, i.pos_))
                    continue
                logging.info("MeAdapter: Scanning :: {} : {}".format(
                    i.text, i.pos_))
                if i.pos_ == 'ADJ':
                    try:
                        cos = cosine_similarity([str(i.lower_)], ['sugaroid'])
                    except ZeroDivisionError:
                        cos = 0.0
                    if i.lower_ == 'sugaroid':
                        nn = i.text
                        response = "Yup, that's my name. I am sugaroid"
                        emotion = Emotion.lol
                        confidence = 0.9
                        break
                    elif cos > 0.9:
                        response = "Yes, you were close! My name is sugaroid"
                        emotion = Emotion.positive
                        confidence = 0.9
                        break
                    else:
                        if i.lower_ in ['human', 'animal', 'bird']:
                            response = 'No, I am not a {adj}. I am a robot'.format(
                                adj=i.lower_)
                            emotion = Emotion.angry_non_expressive
                            confidence = 0.9
                        else:
                            response = 'seriously?'
                            emotion = Emotion.angry
                            confidence = 0.09

                elif i.pos_ == 'PROPN':
                    cos = cosine_similarity([str(i.lower_)], ['sugaroid'])

                    if i.lower_ == 'sugaroid':
                        nn = i.text
                        response = "Yup, that's my name. I am sugaroid"
                        emotion = Emotion.lol
                        confidence = 0.9
                        break
                    elif cos > 0.9:
                        response = "Yes, you were close! My name is sugaroid"
                        emotion = Emotion.positive
                        confidence = 0.9
                        break
                    else:

                        nn = i.text
                        response = "Nope, I am not {n}, I am sugaroid".format(
                            n=nn)
                        emotion = Emotion.angry
                        confidence = 0.9

                elif i.tag_ == 'NN':
                    if i.lower_ in [
                            'bot', 'robot', 'computer', 'silicon', 'infant'
                    ]:
                        response = 'You are right! I am a {}'.format(i.lower_)
                        confidence = 0.9
                        emotion = Emotion.positive
                    elif i.lower_ in [
                            'human', 'bird', 'animal', 'tree', 'politician',
                            'player', 'liar', 'priest'
                    ]:
                        response = 'No way! I can\'t imagine myself to be a {}'.format(
                            i.lower_)
                        confidence = 0.9
                        emotion = Emotion.vomit
                    else:
                        logging.info(
                            "MeAdapter: Couldn't classify type of noun {}".
                            format(i.lower_))
                        confidence = 0.9
                        sia = SentimentIntensityAnalyzer()
                        ps = sia.polarity_scores(str(i.sent))
                        if ps['neu'] == 1.0:
                            # try presence adapter pieces
                            presence_statement = process_what_ami_doing(
                                statement)
                            if presence_statement.confidence == 0:

                                response = 'I will need more time to learn if that actually makes sense with respect to ' \
                                           'myself. '
                                emotion = Emotion.cry
                            else:
                                return presence_statement
                        elif ps['pos'] > ps['neg']:
                            response = 'I guess I am {}. Thanks!'.format(
                                i.text)
                            emotion = Emotion.wink
                        else:
                            response = 'I am not {}! I am Sugaroid.'.format(
                                i.lower_)
                            emotion = Emotion.angry

                elif i.tag_.startswith('VB'):
                    root_verb = i.lemma_
                    if root_verb in [
                            'say', 'tell', 'speak', 'murmur', 'blabber',
                            'flirt'
                    ]:
                        response = random_response(BURN_IDK)
                        emotion = Emotion.lol
                        confidence = 0.8

        else:
            presence_statement = process_what_ami_doing(statement)
            if presence_statement.confidence == 0:
                # FIXME : Add more logic here
                response = 'Ok'
                confidence = 0.05
                emotion = Emotion.non_expressive_left
            else:
                return presence_statement

        selected_statement = SugaroidStatement(response, chatbot=True)
        selected_statement.confidence = confidence
        selected_statement.emotion = emotion
        return selected_statement
コード例 #4
0
ファイル: rereversei.py プロジェクト: TheDarkDrake/sugaroid
    def process(self,
                statement,
                additional_response_selection_parameters=None):
        _ = normalize
        emotion = Emotion.neutral
        self.normalized = normalize(str(statement))
        if self.chatbot.globals['reversei']['type'] is str:
            ordinal_statement = str(statement).replace('9th', 'ninth')
            # FIXME PORT RO
            if cosine_similarity(
                    _(ordinal_statement),
                    _(self.chatbot.globals['reversei']['uid'])) > 0.8:
                response = 'Exactly, you got it right!'
                emotion = Emotion.positive
                reset_reverse(self)
            else:
                response = 'Close! it was {}'.format(
                    self.chatbot.globals['reversei']['uid'])
                emotion = Emotion.lol
                reset_reverse(self)
            confidence = 0.99
        elif self.chatbot.globals['reversei']['type'] is bool:

            if self.chatbot.globals['reversei']['uid'] == 30000000001:
                """
                NameAdapter: token 30000000001
                """
                if ('yes' in self.normalized) or ('yea' in self.normalized):
                    response = "Ok, will keep that in mind!"
                    self.chatbot.globals['USERNAME'] = self.chatbot.globals[
                        'nn']
                    self.chatbot.globals['nn'] = None
                    reset_reverse(self)
                else:
                    response = "Ok, I guess I am smart"
                    emotion = Emotion.wink
                    reset_reverse(self)
                confidence = 1.0
            else:
                if ('yes' in self.normalized) or ('yea' in self.normalized):
                    if len(self.chatbot.globals['history']['total']) > 1:
                        if 'joke' in _(
                                str(self.chatbot.globals['history']['total']
                                    [-1])):
                            joke = pyjokes.get_joke('en', 'all')
                            selected_statement = SugaroidStatement(
                                joke, chatbot=True)
                            selected_statement.emotion = Emotion.lol
                            selected_statement.confidence = 0.95
                            return selected_statement

                        else:
                            # TODO: Not Implemented yet
                            response = 'Ok. (# Not Implemented yet. LOL)'
                else:
                    response = 'Ok then, probably next time'
                    reset_reverse(self)
                confidence = 1.0
        elif self.chatbot.globals['reversei']['type'] is None and \
                (not self.chatbot.globals['reversei']['uid'] == 'CORONAVIRUS'):
            fname = False
            name = difference(self.normalized,
                              ['my', 'name', 'is', 'good', 'be'])
            tokenized = nltk.pos_tag(name)
            for i in tokenized:
                if i[1] == 'NN':
                    fname = i[0]
                    break
            if fname:
                response = "Nice to meet you {}".format(fname)
                emotion = Emotion.positive
                reset_reverse(self)
            else:
                response = "I couldn't find your name. 🥦"
                emotion = Emotion.non_expressive_left
                reset_reverse(self)
            confidence = 1
        elif self.chatbot.globals['reversei']['type'] is int:
            confidence = 2.0  # FIXME: Override Mathematical Evaluation when not necessary

            if self.chatbot.globals['reversei']['uid'] == 30000000002:
                """
                WikiAdapter: token 30000000002
                """
                if ('yes' in self.normalized) or ('yea' in self.normalized):
                    response = "I thought you would tell me a number to choose from :/"
                    emotion = Emotion.seriously

                elif ('no' in self.normalized) or ('no' in self.normalized):
                    response = 'Oops! Sorry about that, seems like what you\'re searching for is not on Wikipedia yet'
                    emotion = Emotion.dead
                    reset_reverse(self)
                else:
                    chatbot_temporary_data = self.chatbot.globals['temp_data']
                    tokenized = nltk.pos_tag(tokenize(str(statement)))
                    for i in tokenized:
                        if i[1] == 'CD':
                            try:
                                num = int(i[0])
                            except ValueError:
                                num = text2int(i[0].lower())
                            index = num - 1
                            if index < len(chatbot_temporary_data):
                                response, confidence, stat = wikipedia_search(
                                    self, chatbot_temporary_data[index])
                                logging.info('REVERSEI: {}'.format(response))
                                confidence = 1 + confidence  # FIXME override math evaluation adapter
                                if not stat:
                                    response = "I have some trouble connecting to Wikipedia. Something's not right"
                                    confidence = 1.1

                                emotion = Emotion.rich
                                reset_reverse(self)
                                break
                            else:
                                response = "Sorry, I couldn't find the item you were choosing. "
                                confidence = 1.1
                                emotion = Emotion.cry_overflow
                                reset_reverse(self)
                                break
                    else:
                        response = 'I thought you wanted to know something from wikipedia. ' \
                                   'Ok, I will try something else'
                        emotion = Emotion.seriously
                        reset_reverse(self)
                        confidence = 1.2
        else:
            if self.chatbot.globals['reversei']['uid'] == 'CORONAVIRUS':
                confidence = 1
                NUM = self.chatbot.globals['reversei']['data'][0]

                score = self.chatbot.globals['reversei']['data'][1]
                if NUM == 6:
                    self.chatbot.globals['reversei']['enabled'] = False
                    if score > 3:
                        response = 'You have a high risk of COVID-19'
                    else:
                        response = 'As per my approximation, you do not have a high risk of COVID-19'
                    response += "\n My approximations might not be correct. " \
                                "You might confirm my results by a legal test"
                else:
                    sia = SentimentIntensityAnalyzer()
                    _scores = sia.polarity_scores(str(statement))
                    true_responses = ['yes', 'yea', 'y', 'yup', 'true']
                    if any_in(
                            true_responses +
                        [x.capitalize()
                         for x in true_responses], self.normalized) or (
                             _scores['pos'] > _scores['neg']):
                        score += COVID_QUESTIONS[NUM - 1][2]
                    response = COVID_QUESTIONS[NUM][1]

                    self.chatbot.globals['reversei']['data'] = [NUM + 1, score]

            else:
                response = 'ok'

                confidence = 0

        selected_statement = SugaroidStatement(response, chatbot=True)
        selected_statement.confidence = confidence

        selected_statement.emotion = emotion

        return selected_statement