<commit_before>import cv2
import os
import numpy as np
import imutils
from hutts_utils.hutts_logger import logger

TEMPLATE_DIR = "{base_path}/templates/".format(base_path=os.path.abspath(os.path.dirname(__file__)))


class TemplateMatching:
    """
    The TemplateMatching class receives template images to identify the type of identification
    that is used in the image.
    Thus you provide it with templates and it will identify whether you used an id card, id book etc.
    """

    def __init__(self):
        self.template = [(1034, cv2.imread(TEMPLATE_DIR + "temp_flag.jpg"), 0.75, "idcard"),
                         (875, cv2.imread(TEMPLATE_DIR + "wap.jpg"), 0.60, "idbook"),
                         (1280, cv2.imread(TEMPLATE_DIR + "pp2.jpg"), 0.60, "studentcard")]

    def identify(self, source):
        """
        This function identifies the src image by searching for the templates provided.
        Author(s):
            <NAME>
        Args:
            Image : The image that needs to be identified

        Returns:
            dict obj: Returns a type if no type could be identified, None is returned
        Todo:
            Explain to others how to use and sort the thresholds in descending order.

        Example usage:
        identify(args["image"]])
        """

        # load the source and template image
        for (original_template_image_width, template_image, threshold, object_identifier) in self.template:<commit_msg>Revert "hotfix: point to correct path for templates"<commit_after>import cv2
import os
import numpy as np
import imutils
from hutts_utils.hutts_logger import logger

DESKTOP = os.path.join(os.path.join(os.path.expanduser('~')), 'Desktop')


class TemplateMatching:
    """
    The TemplateMatching class receives template images to identify the type of identification
    that is used in the image.
    Thus you provide it with templates and it will identify whether you used an id card, id book etc.
    """

    def __init__(self):
        self.template = [(1034, cv2.imread(DESKTOP + "/templates/temp_flag.jpg"), 0.75, "idcard"),
                         (875, cv2.imread(DESKTOP + "/templates/wap.jpg"), 0.60, "idbook"),
                         (1280, cv2.imread(DESKTOP + "/templates/pp2.jpg"), 0.60, "studentcard")]

    def identify(self, source):
        """
        This function identifies the src image by searching for the templates provided.
        Author(s):
            <NAME>
        Args:
            Image : The image that needs to be identified

        Returns:
            dict obj: Returns a type if no type could be identified, None is returned
        Todo:
            Explain to others how to use and sort the thresholds in descending order.

        Example usage:
        identify(args["image"]])
        """

        # load the source and template image
        for (original_template_image_width, template_image, threshold, object_identifier) in self.template:
{'fraction_non_alphanumeric': 0.0883248730964467, 'fraction_numerical': 0.01692047377326565, 'mean_word_length': 2.570048309178744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '11300', 'n_tokens_mistral': 849, 'n_tokens_neox': 797, 'n_words': 295}