<commit_before># CMake script to find primitiv library.
#
# Once done, this script will define:
#
#   PRIMITIV_FOUND - Whether or not the system has the primitiv library.
#   PRIMITIV_INCLUDE_DIR - primitiv include directory.
#   PRIMITIV_LIBRARIES - primitiv library files.
#
#   PRIMITIV_C_FOUND - Whether or not the system has the primitiv C API.
#   PRIMITIV_C_INCLUDE_DIR - primitiv C API include directory.
#   PRIMITIV_C_LIBRARIES - primitiv C API library files.
#
# This script reads hints about search locations from the following
# environment variables:
#
#   PRIMITIV_ROOT
#   PRIMITIV_ROOT_DIR
#
# Author: <NAME> (odashi) <<EMAIL>>
# Created: 2017/08/13
# Updated: 2017/12/15
#
# This script is provided as a part of the primitiv core library.
# Redistributing and using this script is allowed according to
# the Apache License Version 2.


#
# Finding primitiv core library
#

find_path(PRIMITIV_INCLUDE_DIR NAMES primitiv/primitiv.h
  HINTS
  ENV PRIMITIV_ROOT
  ENV PRIMITIV_ROOT_DIR
  PATHS
  ${CMAKE_INSTALL_PREFIX}/include
)

find_library(PRIMITIV_LIBRARIES NAMES primitiv
  HINTS
  ENV PRIMITIV_ROOT
  ENV PRIMITIV_ROOT_DIR
  PATHS
  ${CMAKE_INSTALL_PREFIX}/lib
)

if (PRIMITIV_INCLUDE_DIR AND PRIMITIV_LIBRARIES)
  message("-- Found Primitiv: " ${PRIMITIV_LIBRARIES})
  #message("-- Primitiv include dir: " ${PRIMITIV_INCLUDE_DIR})
  #message("-- Primitiv libraries: " ${PRIMITIV_LIBRARIES})
  set(PRIMITIV_FOUND ON)
else()
  message(STATUS "Primitiv is not installed.")
  set(PRIMITIV_FOUND OFF)
endif()


#
# Finding primitiv C API
#

find_path(PRIMITIV_C_INCLUDE_DIR NAMES primitiv/c/api.h
  HINTS
  ENV PRIMITIV_ROOT
  ENV PRIMITIV_ROOT_DIR
  PATHS
  ${CMAKE_INSTALL_PREFIX}/include
)

find_library(PRIMITIV_C_LIBRARIES NAMES primitiv_c
  HINTS
  ENV PRIMITIV_ROOT
  ENV PRIMITIV_ROOT_DIR
  PATHS
  ${CMAKE_INSTALL_PREFIX}/lib
)

if (PRIMITIV_C_INCLUDE_DIR AND PRIMITIV_C_LIBRARIES)
  message("-- Found Primitiv C API: " ${PRIMITIV_C_LIBRARIES})
  #message("-- Primitiv C API include dir: " ${PRIMITIV_C_INCLUDE_DIR})
  #message("-- Primitiv C API libraries: " ${PRIMITIV_C_LIBRARIES})
  set(PRIMITIV_C_FOUND ON)
else()
  message(STATUS "Primitiv C API is not installed.")
  set(PRIMITIV_C_FOUND OFF)
endif()
<commit_msg>Make FindPrimitiv.cmake to check the header version.<commit_after># CMake script to find primitiv library.
#
# Once done, this script will define:
#
#   PRIMITIV_FOUND - Whether or not the system has the primitiv library.
#   PRIMITIV_INCLUDE_DIR - primitiv include directory.
#   PRIMITIV_LIBRARIES - primitiv library files.
#
#   PRIMITIV_C_FOUND - Whether or not the system has the primitiv C API.
#   PRIMITIV_C_INCLUDE_DIR - primitiv C API include directory.
#   PRIMITIV_C_LIBRARIES - primitiv C API library files.
#
#   PRIMITIV_VERSION - Header version of the installed library.
#   PRIMITIV_VERSION_OK - `ON` if the installed header satisfies version
#                         requirement, `OFF` otherwise.
#
# This script reads hints about search locations from the following
# environment variables:
#
#   PRIMITIV_ROOT
#   PRIMITIV_ROOT_DIR
#
# Author: <NAME> (odashi) <<EMAIL>>
# Created: 2017/08/13
# Updated: 2017/12/15
#
# This script is provided as a part of the primitiv core library.
# Redistributing and using this script is allowed according to
# the Apache License Version 2.


#
# Finds primitiv core library
#

find_path(PRIMITIV_INCLUDE_DIR NAMES primitiv/primitiv.h
  HINTS
  ENV PRIMITIV_ROOT
  ENV PRIMITIV_ROOT_DIR
  PATHS
  ${CMAKE_INSTALL_PREFIX}/include
)

find_library(PRIMITIV_LIBRARIES NAMES primitiv
  HINTS
  ENV PRIMITIV_ROOT
  ENV PRIMITIV_ROOT_DIR
  PATHS
  ${CMAKE_INSTALL_PREFIX}/lib
)

if (PRIMITIV_INCLUDE_DIR AND PRIMITIV_LIBRARIES)
  message("-- Found primitiv: " ${PRIMITIV_LIBRARIES})
  #message("-- primitiv include dir: " ${PRIMITIV_INCLUDE_DIR})
  #message("-- primitiv libraries: " ${PRIMITIV_LIBRARIES})
  set(PRIMITIV_FOUND ON)
else()
  message(STATUS "primitiv is not installed.")
  set(PRIMITIV_FOUND OFF)
endif()


#
# Finds primitiv C API
#

find_path(PRIMITIV_C_INCLUDE_DIR NAMES primitiv/c/api.h
  HINTS
  ENV PRIMITIV_ROOT
  ENV PRIMITIV_ROOT_DIR
  PATHS
  ${CMAKE_INSTALL_PREFIX}/include
)

find_library(PRIMITIV_C_LIBRARIES NAMES primitiv_c
  HINTS
  ENV PRIMITIV_ROOT
  ENV PRIMITIV_ROOT_DIR
  PATHS
  ${CMAKE_INSTALL_PREFIX}/lib
)

if (PRIMITIV_C_INCLUDE_DIR AND PRIMITIV_C_LIBRARIES)
  message("-- Found primitiv C API: " ${PRIMITIV_C_LIBRARIES})
  #message("-- primitiv C API include dir: " ${PRIMITIV_C_INCLUDE_DIR})
  #message("-- primitiv C API libraries: " ${PRIMITIV_C_LIBRARIES})
  set(PRIMITIV_C_FOUND ON)
else()
  message(STATUS "Primitiv C API is not installed.")
  set(PRIMITIV_C_FOUND OFF)
endif()


#
# Checks version
#

if(NOT Primitiv_FIND_VERSION)
  set(Primitiv_FIND_VERSION "${Primitiv_FIND_VERSION_MAJOR}.${Primitiv_FIND_VERSION_MINOR}.${Primitiv_FIND_VERSION_PATCH}")
endif()

file(READ
  "${PRIMITIV_INCLUDE_DIR}/primitiv/version.h"
  _primitiv_version_header
)

string(REGEX MATCH
  "#[ \t]*define[ \t]+PRIMITIV_VERSION_MAJOR[ \t]+([0-9]+)"
  _primitiv_version_match "${_primitiv_version_header}"
)
set(PRIMITIV_VERSION_MAJOR "${CMAKE_MATCH_1}")

string(REGEX MATCH
  "#[ \t]*define[ \t]+PRIMITIV_VERSION_MINOR[ \t]+([0-9]+)"
  _primitiv_version_match "${_primitiv_version_header}"
)
set(PRIMITIV_VERSION_MINOR "${CMAKE_MATCH_1}")

string(REGEX MATCH
  "#[ \t]*define[ \t]+PRIMITIV_VERSION_PATCH[ \t]+([0-9]+)"
  _primitiv_version_match "${_primitiv_version_header}"
)
set(PRIMITIV_VERSION_PATCH "${CMAKE_MATCH_1}")

set(PRIMITIV_VERSION "${PRIMITIV_VERSION_MAJOR}.${PRIMITIV_VERSION_MINOR}.${PRIMITIV_VERSION_PATCH}")

#message("primitiv version requested: ${PRIMITIV_FIND_VERSION}")
#message("primitiv version found: ${PRIMITIV_VERSION}")

if(${PRIMITIV_VERSION} VERSION_LESS ${Primitiv_FIND_VERSION})
  message(STATUS
    "primitiv version ${PRIMITIV_VERSION} found in ${PRIMITIV_INCLUDE_DIR}, "
    "but at least version ${Primitiv_FIND_VERSION} is required."
  )
  set(PRIMITIV_VERSION_OK OFF)
else()
  set(PRIMITIV_VERSION_OK ON)
endif()
{'fraction_non_alphanumeric': 0.098403817673194, 'fraction_numerical': 0.007075859799243048, 'mean_word_length': 5.114688128772636, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5596034', 'n_tokens_mistral': 2398, 'n_tokens_neox': 2351, 'n_words': 522}