• Check if title contains the complete search term and return significance score. Significance is measured as the proportion of the full title that the search term represents.

    Parameters

    • normalizedTitle: string

      The normalized manga title

    • normalizedSearchTitle: string

      The normalized search title

    Returns number

    Significance score between 0 and 1 (search term length / full title length), or 0 if not contained

    export function containsCompleteTitle(
    normalizedTitle: string,
    normalizedSearchTitle: string,
    ): number {
    if (normalizedTitle.includes(normalizedSearchTitle)) {
    // Calculate how significant the contained title is compared to the full title
    // (Higher score when the search term represents more of the full title)
    return normalizedSearchTitle.length / normalizedTitle.length;
    }
    return 0;
    }