<commit_before>/*
 * Copyright (c) 2016 <NAME> <rmind at noxt eu>
 * All rights reserved.
 *
 * Use is subject to license terms, as specified in the LICENSE file.
 */

#include <stdlib.h>
#include <inttypes.h>

#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>

#include "lpm.h"

int		luaopen_lpm(lua_State *);
static int	lua_lpm_new(lua_State *);
static int	lua_lpm_tobin(lua_State *);
static int	lua_lpm_insert(lua_State *);
static int	lua_lpm_remove(lua_State *);
static int	lua_lpm_lookup(lua_State *);
static int	lua_lpm_clear(lua_State *);
static int	lua_lpm_gc(lua_State *);

static const struct luaL_reg lpm_lib_methods[] = {
	{ "new",	lua_lpm_new	},
	{ "tobin",	lua_lpm_tobin	},
	{ NULL,		NULL		}
};

static const struct luaL_reg lpm_methods[] = {
	{ "insert",	lua_lpm_insert	},
	{ "remove",	lua_lpm_remove	},<commit_msg>Lua binding: fix for 5.3 and newer versions.<commit_after>/*
 * Copyright (c) 2016 <NAME> <rmind at noxt eu>
 * All rights reserved.
 *
 * Use is subject to license terms, as specified in the LICENSE file.
 */

#include <stdlib.h>
#include <inttypes.h>

#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>

#include "lpm.h"

int		luaopen_lpm(lua_State *);
static int	lua_lpm_new(lua_State *);
static int	lua_lpm_tobin(lua_State *);
static int	lua_lpm_insert(lua_State *);
static int	lua_lpm_remove(lua_State *);
static int	lua_lpm_lookup(lua_State *);
static int	lua_lpm_clear(lua_State *);
static int	lua_lpm_gc(lua_State *);

static const struct luaL_Reg lpm_lib_methods[] = {
	{ "new",	lua_lpm_new	},
	{ "tobin",	lua_lpm_tobin	},
	{ NULL,		NULL		}
};

static const struct luaL_Reg lpm_methods[] = {
	{ "insert",	lua_lpm_insert	},
	{ "remove",	lua_lpm_remove	},
{'fraction_non_alphanumeric': 0.1341534856473345, 'fraction_numerical': 0.005858230814294083, 'mean_word_length': 5.1, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '6465631', 'n_tokens_mistral': 723, 'n_tokens_neox': 697, 'n_words': 165}