<commit_before>import cmd
import random
import sys
import time
import logging
import requests
import threading
import readline
import traceback
import warnings
from bs4 import BeautifulSoup

from will import settings
from will.utils import Bunch, UNSURE_REPLIES
from will.abstractions import Message, Person, Channel
from .base import StdInOutIOBackend

warnings.filterwarnings("ignore", category=UserWarning, module='bs4')


class ShellBackend(StdInOutIOBackend):
    friendly_name = "Interactive Shell"
    internal_name = "will.backends.io_adapters.shell"
    partner = Person(
        id="you",
        handle="you",
        source=Bunch(),
        name="Friend",
    )

    def _strip_html_tags(self, message_body):
        return BeautifulSoup(message_body, 'html.parser').get_text()

    def send_direct_message(self, message_body, **kwargs):
        print("Will: %s" % self._strip_html_tags(message_body))

    def send_room_message(self, room_id, message_body, html=False, color="green", notify=False, **kwargs):
        print("Will: %s" % self._strip_html_tags(message_body))

    def set_room_topic(self, room_id, topic):
        print("Will: Setting the Topic to %s" & topic)

    def normalize_incoming_event(self, event):
        if event["type"] == "message.incoming.stdin":
            m = Message(
                content=event.data.content.strip(),
                type=event.type,
                is_direct=True,
                is_private_chat=True,
                is_group_chat=False,
                backend=self.name,
                sender=self.partner,
                will_is_mentioned=False,
                will_said_it=False,
                backend_supports_acl=False,
                source=event<commit_msg>Uses built-in html_to_text<commit_after>import cmd
import random
import sys
import time
import logging
import requests
import threading
import readline
import traceback
import warnings

from will import settings
from will.utils import Bunch, UNSURE_REPLIES, html_to_text
from will.abstractions import Message, Person, Channel
from .base import StdInOutIOBackend

warnings.filterwarnings("ignore", category=UserWarning, module='bs4')


class ShellBackend(StdInOutIOBackend):
    friendly_name = "Interactive Shell"
    internal_name = "will.backends.io_adapters.shell"
    partner = Person(
        id="you",
        handle="you",
        source=Bunch(),
        name="Friend",
    )


    def send_direct_message(self, message_body, **kwargs):
        print("Will: %s" % html_to_text(message_body))

    def send_room_message(self, room_id, message_body, html=False, color="green", notify=False, **kwargs):
        print("Will: %s" % html_to_text(message_body))

    def set_room_topic(self, room_id, topic):
        print("Will: Setting the Topic to %s" & topic)

    def normalize_incoming_event(self, event):
        if event["type"] == "message.incoming.stdin":
            m = Message(
                content=event.data.content.strip(),
                type=event.type,
                is_direct=True,
                is_private_chat=True,
                is_group_chat=False,
                backend=self.name,
                sender=self.partner,
                will_is_mentioned=False,
                will_said_it=False,
                backend_supports_acl=False,
                source=event
{'fraction_non_alphanumeric': 0.09479665071770335, 'fraction_numerical': 0.0008971291866028708, 'mean_word_length': 2.8492520138089756, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5506775', 'n_tokens_mistral': 1001, 'n_tokens_neox': 965, 'n_words': 218}