<commit_before>''' This script start the online monitor with the example entities (simulation producer, converter, receiver)

Thre online monitor should actually be used from the console und not with a start script like used here!

Go to this folder and type:
start_online_monitor configuration.yaml
'''

import subprocess
import os

import online_monitor
from online_monitor.utils import settings


def run_script_in_shell(script, arguments, command=None):
    return subprocess.Popen("%s %s %s" % ('python' if not command else command, script, arguments), shell=True, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP if os.name == 'nt' else 0)

if __name__ == '__main__':
    package_path = os.path.dirname(online_monitor.__file__)  # Get the absoulte path of the online_monitor installation
    settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim')))
    settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter')))
    settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver')))
    run_script_in_shell('', 'configuration.yaml', 'start_online_monitor')<commit_msg>REG: example path corrected<commit_after>''' This script starts the online monitor with the example entities

    The entities are: simulation producer, converter, receiver

    The online monitor should actually be used with its entry point
    from the terminal und not with a start script like used here!

    To use the entry point in a terminal go to this folder and type:
    start_online_monitor configuration.yaml
'''

import subprocess
import os

import online_monitor
from online_monitor.utils import settings


def run_script_in_shell(script, arguments, command=None):
    if os.name == 'nt':
        creationflags = subprocess.CREATE_NEW_PROCESS_GROUP
    else:
        creationflags = 0
    return subprocess.Popen("%s %s %s" % ('python' if not command else command,
                                          script, arguments), shell=True,
                            creationflags=creationflags)

if __name__ == '__main__':
    # Get the absoulte path of the online_monitor installation
    package_path = os.path.dirname(online_monitor.__file__)
    # Add examples folder to entity search paths
    settings.add_producer_sim_path(os.path.join(package_path,
                                                'examples',
                                                'producer_sim'))
    settings.add_converter_path(os.path.join(package_path,
                                             'examples',
                                             'converter'))
    settings.add_receiver_path(os.path.join(package_path,
                                            'examples',
                                            'receiver'))
    run_script_in_shell('', 'configuration.yaml', 'start_online_monitor')
{'fraction_non_alphanumeric': 0.08565737051792828, 'fraction_numerical': 0.0006640106241699867, 'mean_word_length': 2.954068241469816, 'pattern_counts': {'":': 0, '<': 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': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4729964', 'n_tokens_mistral': 800, 'n_tokens_neox': 778, 'n_words': 224}