<commit_before><?php
/**
 * This is the implentation of the wordstoavoid functionality
 */

class WordsToAvoidPlugin extends MGDictionaryPlugin
{
    public $enableOnInstall = true;
    public $hasAdmin = true;

    /**
     * Parses the submission and regiesters for each of the previous turns images the
     * words that have been set as words to avoid. We can't regenerate the wordstoavoid
     * as in meantime the list might have changed. We have to use the words the player has
     * seen.
     *
     * @param object $game the game object
     * @param object $game_model the active model of the current game
     * @return boolean true if the validation after parsing was successful
     */
    function parseSubmission(&$game, &$game_model)
    {
        $game->request->wordstoavoid = array();
        if (isset($_POST["wordstoavoid"]) && is_array($_POST["wordstoavoid"]) && count($_POST["wordstoavoid"]) > 0) {
            foreach ($_POST["wordstoavoid"] as $image_id => $image) {
                if (is_array($image) && count($image) > 0) {
                    $game->request->wordstoavoid[$image_id] = $image;
                }
            }
        }
        return true;
    }

    /**
     * Checks if the tags submitted are on the wordstoavoid list. If they do set the
     * weight to 0 and the tags type to wordstoavoid.
     *
     * @param MGGameModel $gameModel
     * @param array $tags the tags to be looked up as a single dimension array array('tag1', 'tag2', ...)
     * #
     */
    function setWeights($gameModel, $tags)
    {
        // go through last turns words to avoid and weight matching tags 0
        if (isset($gameModel->wordstoavoid) && is_array($gameModel->wordstoavoid)) {
            foreach ($gameModel->wordstoavoid as $wta_image_id => $wta_image) {
                if (array_key_exists($wta_image_id, $tags)) {
                    foreach ($wta_image as $wta_tag_id => $wta_tag) {
                        if (array_key_exists($wta_tag["tag"], $tags[$wta_image_id])) {<commit_msg>fix match parent and child methods difference<commit_after><?php
/**
 * This is the implentation of the wordstoavoid functionality
 */

class WordsToAvoidPlugin extends MGDictionaryPlugin
{
    public $enableOnInstall = true;
    public $hasAdmin = true;

    /**
     * Parses the submission and regiesters for each of the previous turns images the
     * words that have been set as words to avoid. We can't regenerate the wordstoavoid
     * as in meantime the list might have changed. We have to use the words the player has
     * seen.
     *
     * @param object $game the game object
     * @param object $game_model the active model of the current game
     * @return boolean true if the validation after parsing was successful
     */
    function parseSubmission(&$game, &$game_model)
    {
        $game->request->wordstoavoid = array();
        if (isset($_POST["wordstoavoid"]) && is_array($_POST["wordstoavoid"]) && count($_POST["wordstoavoid"]) > 0) {
            foreach ($_POST["wordstoavoid"] as $image_id => $image) {
                if (is_array($image) && count($image) > 0) {
                    $game->request->wordstoavoid[$image_id] = $image;
                }
            }
        }
        return true;
    }

    /**
     * Checks if the tags submitted are on the wordstoavoid list. If they do set the
     * weight to 0 and the tags type to wordstoavoid.
     *
     * @param MGGameModel $gameModel
     * @param array $tags the tags to be looked up as a single dimension array array('tag1', 'tag2', ...)
     * #
     */
    function setWeights(&$gameModel, $tags)
    {
        // go through last turns words to avoid and weight matching tags 0
        if (isset($gameModel->wordstoavoid) && is_array($gameModel->wordstoavoid)) {
            foreach ($gameModel->wordstoavoid as $wta_image_id => $wta_image) {
                if (array_key_exists($wta_image_id, $tags)) {
                    foreach ($wta_image as $wta_tag_id => $wta_tag) {
                        if (array_key_exists($wta_tag["tag"], $tags[$wta_image_id])) {
{'fraction_non_alphanumeric': 0.10736121301051602, 'fraction_numerical': 0.00293470286133529, 'mean_word_length': 2.4987168520102654, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '3526917', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1147, 'n_words': 386}