<commit_before>#include "types.h"
#include "result.h"
#include "arm/atomics.h"
#include "kernel/ipc.h"
#include "services/apm.h"
#include "services/sm.h"

static Service g_apmSrv;
static Service g_apmISession;
static u64 g_refCnt;

static Result _apmGetSession(Service* srv, Service* srv_out, u64 cmd_id);

Result apmInitialize(void)
{
    atomicIncrement64(&g_refCnt);

    if (serviceIsActive(&g_apmSrv))
        return 0;

    Result rc = 0;

    rc = smGetService(&g_apmSrv, "apm:p");

    if (R_FAILED(rc))
        rc = smGetService(&g_apmSrv, "apm");

    // OpenSession.
    // Official sw doesn't open this until using commands which need it, when it wasn't already opened.<commit_msg>Remove apm:p support as per 8.0.0<commit_after>#include "types.h"
#include "result.h"
#include "arm/atomics.h"
#include "kernel/ipc.h"
#include "services/apm.h"
#include "services/sm.h"

static Service g_apmSrv;
static Service g_apmISession;
static u64 g_refCnt;

static Result _apmGetSession(Service* srv, Service* srv_out, u64 cmd_id);

Result apmInitialize(void)
{
    atomicIncrement64(&g_refCnt);

    if (serviceIsActive(&g_apmSrv))
        return 0;

    Result rc = 0;

    rc = smGetService(&g_apmSrv, "apm");

    // OpenSession.
    // Official sw doesn't open this until using commands which need it, when it wasn't already opened.
{'fraction_non_alphanumeric': 0.12125748502994012, 'fraction_numerical': 0.014221556886227544, 'mean_word_length': 4.083650190114068, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7427153', 'n_tokens_mistral': 515, 'n_tokens_neox': 493, 'n_words': 127}