def score(self, query, normalized=True, synonimizer=None, return_suffix_scores=False):
        
        query = query.replace(" ", "")
        result = 0
        suffix_scores = {}
    
        # For each suffix of the string:
        for suffix_start in xrange(len(query)):
            
            suffix = query[suffix_start:]
            suffix_score = 0
            suffix_result = 0
            matched_chars = 0
            nodes_matched = 0
            
            child_node = self.root.chose_arc(suffix)
            while child_node:
                nodes_matched += 1
                (str_ind, substr_start, substr_end) = child_node.arc()
                match = utils.match_strings(
                            suffix, self.strings_collection[str_ind][substr_start:substr_end])
                suffix_score += child_node.conditional_probability()
                matched_chars += match
                suffix = suffix[match:]
                if suffix and match == substr_end - substr_start:
                    child_node = child_node.chose_arc(suffix)
                else:
                    break
            
            if matched_chars:
                suffix_result = (suffix_score + matched_chars - nodes_matched)
                if normalized:
                    suffix_result /= matched_chars
                result += suffix_result

            suffix_scores[query[suffix_start:]] = suffix_result
                    
        result /= len(query)

        if return_suffix_scores:
            result = result, suffix_scores
        
        return result
Matches the string against the GAST using
dataset/ETHPy150Open mikhaildubov/AST-text-analysis/east/asts/ast.py/AnnotatedSuffixTree.score