howlongtobeatpy/howlongtobeatpy/HTMLResultParser.py
def similar(a, b, game_name_numbers, similarity_case_sensitive):
        """
        This function calculate how much the first string is similar to the second string
        @param a: First String
        @param b: Second String
        @param game_name_numbers: All the numbers in <a> string, used for an additional check
        @param similarity_case_sensitive: If the SequenceMatcher() should be case sensitive (true) or ignore case (false)
        @return: Return the similarity between the two string (0.0-1.0)
        """
        if a is None or b is None:
            return 0
        # Check if we want a case sensitive compare or not
        if similarity_case_sensitive:
            similarity = SequenceMatcher(None, a, b).ratio()
        else:
            similarity = SequenceMatcher(None, a.lower(), b.lower()).ratio()
        if game_name_numbers is not None and len(game_name_numbers) > 0:  # additional check about numbers in the string
            number_found = False
            cleaned = re.sub(r'([^\s\w]|_)+', '', b)
            for word in cleaned.split(" "):  # check for every word
                if word.isdigit():  # if is a digit
                    for number_entry in game_name_numbers:  # compare it with numbers in the begin string
                        if str(number_entry) == str(word):
                            number_found = True
                            break
            if not number_found:  # number in the given string not in this one, reduce prob
                similarity -= 0.1
        return similarity

        This function calculate how much the first string is similar to the second string
        @param a: First String
        @param b: Second String
        @param game_name_numbers: All the numbers in <a> string, used for an additional check
        @param similarity_case_sensitive: If the SequenceMatcher() should be case sensitive (true) or ignore case (false)
        @return: Return the similarity between the two string (0.0-1.0)
        
This function calculate how much the first string is similar to the second string
This function calculate how much the first string is similar to the second string
def similar(a, b, game_name_numbers, similarity_case_sensitive):
        if a is None or b is None:
            return 0
        if similarity_case_sensitive:
            similarity = SequenceMatcher(None, a, b).ratio()
        else:
            similarity = SequenceMatcher(None, a.lower(), b.lower()).ratio()
        if game_name_numbers is not None and len(game_name_numbers) > 0:  
            number_found = False
            cleaned = re.sub(r'([^\s\w]|_)+', '', b)
            for word in cleaned.split(" "):  
                if word.isdigit():  
                    for number_entry in game_name_numbers:  
                        if str(number_entry) == str(word):
                            number_found = True
                            break
            if not number_found:  
                similarity -= 0.1
        return similarity
def similar ( a , b , game_name_numbers , similarity_case_sensitive ) : if a is None or b is None : return 0 if similarity_case_sensitive : similarity = SequenceMatcher ( None , a , b ) . ratio ( ) else : similarity = SequenceMatcher ( None , a . lower ( ) , b . lower ( ) ) . ratio ( ) if game_name_numbers is not None and len ( game_name_numbers ) > 0 : number_found = False cleaned = re . sub ( r'([^\s\w]|_)+' , '' , b ) for word in cleaned . split ( " " ) : if word . isdigit ( ) : for number_entry in game_name_numbers : if str ( number_entry ) == str ( word ) : number_found = True break if not number_found : similarity -= 0.1 return similarity
This function calculate how much the first string is similar to the second string
This function calculate how much the first string is similar to the second string
"""
        This function calculate how much the first string is similar to the second string
        @param a: First String
        @param b: Second String
        @param game_name_numbers: All the numbers in <a> string, used for an additional check
        @param similarity_case_sensitive: If the SequenceMatcher() should be case sensitive (true) or ignore case (false)
        @return: Return the similarity between the two string (0.0-1.0)
        """ # Check if we want a case sensitive compare or not # additional check about numbers in the string # check for every word # if is a digit # compare it with numbers in the begin string # number in the given string not in this one, reduce prob
Return the similarity between the two string (0.0-1.0)
Return the similarity between the two string ( 0 . 0 - 1 . 0 )
a
None
b
None
game_name_numbers
All the numbers in  string, used for an additional check
All the numbers in string used for an additional check
similarity_case_sensitive
If the SequenceMatcher() should be case sensitive (true) or ignore case (false)
If the SequenceMatcher () should be case sensitive ( true ) or ignore case ( false )