function calcularPuntosPost($post_id, $post_data, $datos, $esAdmin, $vistas_posts_processed, $identifier = '', $similar_to = null)
{
    $autor_id = $post_data->post_author;
    $post_date = $post_data->post_date;

    $puntosUsuario = in_array($autor_id, $datos['siguiendo']) ? 20 : 0;
    $puntosIntereses = calcularPuntosIntereses($post_id, $datos);

    // Calculate points based on identifier matches
    $puntosIdentifier = 0;
    if (!empty($identifier)) {
        $puntosIdentifier = calcularPuntosIdentifier($post_id, $identifier);
    }

    // Calculate points based on similarity to the specified post
    $puntosSimilarTo = 0;
    if (!empty($similar_to)) {
        $puntosSimilarTo = calcularPuntosSimilarTo($post_id, $similar_to);
    }

    $likes = isset($datos['likes_by_post'][$post_id]) ? $datos['likes_by_post'][$post_id] : 0;
    $puntosLikes = 30 + $likes;

    $diasDesdePublicacion = (current_time('timestamp') - strtotime($post_date)) / (3600 * 24);
    $factorTiempo = pow(0.99, $diasDesdePublicacion);

    $metaVerificado = isset($datos['verificado_results'][$post_id]->meta_value) && $datos['verificado_results'][$post_id]->meta_value == '1';
    $metaPostAut = isset($datos['postAut_results'][$post_id]->meta_value) && $datos['postAut_results'][$post_id]->meta_value == '1';

    $puntosFinal = calcularPuntosFinales(
        $puntosUsuario,
        $puntosIntereses + $puntosIdentifier + $puntosSimilarTo,
        $puntosLikes,
        $metaVerificado,
        $metaPostAut,
        $esAdmin
    );

    if (isset($vistas_posts_processed[$post_id])) {
        $vistas = $vistas_posts_processed[$post_id]['count'];
        $reduccion_por_vista = 0.50;
        $factorReduccion = pow(1 - $reduccion_por_vista, $vistas);
        $puntosFinal *= $factorReduccion;
    }

    $aleatoriedad = mt_rand(0, 20);
    $puntosFinal = $puntosFinal * (1 + ($aleatoriedad / 100));
    $ajusteExtra = mt_rand(-50, 50);
    $puntosFinal = $puntosFinal * $factorTiempo;
    $puntosFinal += $ajusteExtra;

    return max($puntosFinal, 0);
}

/*
respecto a estas 2 funciones, en los post hay una meta de datosAlgoritmo, donde contiene la informacion valiosa sobre los datos del post que sirven para comparar la similitud de estos datos y el identifier
*/

function calcularPuntosIdentifier($post_id, $identifier)
{
    // Get post content and title
    $post_content = get_post_field('post_content', $post_id);
    $post_title = get_post_field('post_title', $post_id);

    // Combine title and content
    $full_text = $post_title . ' ' . $post_content;

    // Normalize text: lowercase and remove special characters
    $full_text = strtolower($full_text);
    $full_text = preg_replace('/[^\w\s]/u', '', $full_text);

    // Split into words
    $words_in_post = preg_split('/\s+/', $full_text, -1, PREG_SPLIT_NO_EMPTY);

    // Process identifier(s)
    if (is_array($identifier)) {
        $identifiers = $identifier;
    } else {
        $identifiers = preg_split('/\s+/', strtolower($identifier), -1, PREG_SPLIT_NO_EMPTY);
    }

    $count = 0;
    foreach ($identifiers as $id_word) {
        $id_word = trim($id_word);
        if (empty($id_word)) {
            continue;
        }
        $occurrences = array_count_values($words_in_post);
        if (isset($occurrences[$id_word])) {
            $count += $occurrences[$id_word];
        }
    }

    // Assign points based on occurrences
    $puntosIdentifier = $count * 50; // For example, 10 points per occurrence

    return $puntosIdentifier;
}

function calcularPuntosSimilarTo($post_id, $similar_to)
{
    // Get content and title of the current post
    $post_content_1 = get_post_field('post_content', $post_id);
    $post_title_1 = get_post_field('post_title', $post_id);
    $full_text_1 = $post_title_1 . ' ' . $post_content_1;
    $full_text_1 = strtolower($full_text_1);
    $full_text_1 = preg_replace('/[^\w\s]/u', '', $full_text_1);
    $words_in_post_1 = preg_split('/\s+/', $full_text_1, -1, PREG_SPLIT_NO_EMPTY);

    // Get content and title of the post to compare with
    $post_content_2 = get_post_field('post_content', $similar_to);
    $post_title_2 = get_post_field('post_title', $similar_to);
    $full_text_2 = $post_title_2 . ' ' . $post_content_2;
    $full_text_2 = strtolower($full_text_2);
    $full_text_2 = preg_replace('/[^\w\s]/u', '', $full_text_2);
    $words_in_post_2 = preg_split('/\s+/', $full_text_2, -1, PREG_SPLIT_NO_EMPTY);

    if (empty($words_in_post_1) || empty($words_in_post_2)) {
        return 0;
    }

    // Compute similarity as the Jaccard index
    $set1 = array_unique($words_in_post_1);
    $set2 = array_unique($words_in_post_2);

    $intersection = array_intersect($set1, $set2);
    $union = array_unique(array_merge($set1, $set2));

    $similarity = count($intersection) / count($union);

    // Assign points based on similarity
    $puntosSimilarTo = $similarity * 100; // Scale to 0-100 points

    return $puntosSimilarTo;
}

Cosa que ya viene en 

function calcularPuntosIntereses($post_id, $datos)
{
    $puntosIntereses = 0;
    $datosAlgoritmo = !empty($datos['datosAlgoritmo'][$post_id]->meta_value) ? json_decode($datos['datosAlgoritmo'][$post_id]->meta_value, true) : [];
    $oneshot = ['one shot', 'one-shot', 'oneshot'];
    $esOneShot = false;

    foreach ($oneshot as $palabra) {
        if (stripos($datos['datosAlgoritmo'][$post_id]->meta_value, $palabra) !== false) {
            $esOneShot = true;
            break;
        }
    }

    foreach ($datosAlgoritmo as $key => $value) {
        if (is_array($value)) {
            foreach (['es', 'en'] as $lang) {
                if (isset($value[$lang]) && is_array($value[$lang])) {
                    foreach ($value[$lang] as $item) {
                        if (isset($datos['interesesUsuario'][$item])) {
                            $puntosIntereses += 10 + $datos['interesesUsuario'][$item]->intensity;
                        }
                    }
                }
            }
        } elseif (!empty($value) && isset($datos['interesesUsuario'][$value])) {
            $puntosIntereses += 10 + $datos['interesesUsuario'][$value]->intensity;
        }
    }

    if ($esOneShot) {
        $puntosIntereses *= 0.2;
    }

    return $puntosIntereses;
}