<commit_before><commit_msg>added first (incomplete) code snippets<commit_after>/*
 * Copyright (c) 2008, <NAME>
 *
 * Distributed under the Terms of the 3clause BSD License - see LICENSE File
 * if you received this without a copy of the License, please contact the
 * Author (lars<at>chaotika<dot>org) to obtain one
 */

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>

typedef struct {
     char *name;
     char *xpak;
} lpxpak_t;

lpxpak_t *
lpgetxpakstr(const char *s);

lpxpak_t *
lpgetxpakfd(int fd);

lpxpak_t *
lpgetxpakfile(FILE *file);

lpxpak_t *
lpgetxpakpath(char *path);

lpxpak_t *
lpgetxpakstr(const char *s)
{
     lpxpak_t *xpak;
     
     xpak = (lpxpak_t *)malloc(sizeof(lpxpak_t));
     return xpak;
}

lpxpak_t *
lpgetxpakfd(int fd)
{
     lpxpak_t *xpak;
     
     xpak = lpgetxpakfile(NULL);
     return xpak;
}

lpxpak_t *
lpgetxpakfile(FILE *file)
{
     lpxpak_t *xpak;
     
     xpak = lpgetxpakstr(NULL);
     return xpak;
}

lpxpak_t *
lpgetxpakpath(char *path) 
{
     struct stat ststr;
     lpxpak_t *xpak;
     FILE *xpakfile;
     
     if (stat(path, &ststr) == -1) 
          return NULL;
     if (! S_ISREG(ststr.st_mode) ) {
          errno = EINVAL;
     }
     xpakfile = fopen(path, "r");
     
     xpak = lpgetxpakfile(xpakfile);
     return xpak;
}

{'fraction_non_alphanumeric': 0.12338593974175036, 'fraction_numerical': 0.00430416068866571, 'mean_word_length': 3.0086206896551726, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6737302', 'n_tokens_mistral': 610, 'n_tokens_neox': 591, 'n_words': 129}