got.asts package

Submodules

got.asts.ast module

got.asts.ast.AST

alias of got.asts.ast.EASA

class got.asts.ast.EASA(strings_collection)[source]

Bases: got.asts.base.AST

score(query, normalized=True, synonimizer=None, return_suffix_scores=False)[source]

Computes the matching score for the given string against the AST.

traverse_breadth_first(callback)[source]

Visits the internal “nodes” of the enhanced suffix array in breadth-first order.

traverse_depth_first_post_order(callback)[source]

Visits the internal “nodes” of the enhanced suffix array in depth-first post-order.

Kasai et. al. (2001), Abouelhoda et al. (2004).

traverse_depth_first_pre_order(callback)[source]

Visits the internal “nodes” of the enhanced suffix array in depth-first pre-order.

Based on Abouelhoda et al. (2004).

got.asts.base module

class got.asts.base.AST(strings_collection)[source]

Bases: abc.ABC

static get_ast(strings_collection, ast_algorithm='easa')[source]
score(query, normalized=True, synonimizer=None, return_suffix_scores=False)[source]

Computes the matching score for the given string against the AST.

traverse(callback, order='depth-first|pre-order')[source]
traverse_breadth_first(callback)[source]

Traverses the annotated suffix tree in breadth-first order.

traverse_depth_first_post_order(callback)[source]

Traverses the annotated suffix tree in depth-first post-order.

traverse_depth_first_pre_order(callback)[source]

Traverses the annotated suffix tree in depth-first pre-order.

got.asts.consts module

got.asts.exceptions module

exception got.asts.exceptions.EastException(message=None, **kwargs)[source]

Bases: Exception

format_message()[source]
msg_fmt = 'An unknown exception occurred.'
exception got.asts.exceptions.EmptyStringsCollectionException(message=None, **kwargs)[source]

Bases: got.asts.exceptions.EastException

msg_fmt = 'The input strings collection is empty.'
exception got.asts.exceptions.NoSuchASTAlgorithm(message=None, **kwargs)[source]

Bases: got.asts.exceptions.NotFoundException

msg_fmt = 'There is no AST construction algorithm with name `%(name)s`.'
exception got.asts.exceptions.NotFoundException(message=None, **kwargs)[source]

Bases: got.asts.exceptions.EastException

msg_fmt = 'Not found.'

got.asts.utils module

class got.asts.utils.EnumMixin[source]

Bases: object

class got.asts.utils.ImmutableMixin[source]

Bases: object

got.asts.utils.import_modules_from_package(package)[source]
got.asts.utils.index(array, key, start=0)[source]
got.asts.utils.itersubclasses(cls, _seen=None)[source]
got.asts.utils.make_unique_endings(strings_collection)[source]

Make each string in the collection end with a unique character. Essential for correct builiding of a generalized annotated suffix tree. Returns the updated strings collection, encoded in Unicode.

max strings_collection ~ 1.100.000

got.asts.utils.match_strings(str1, str2)[source]

Returns the largest index i such that str1[:i] == str2[:i]

got.asts.utils.tokenize(text)[source]

Module contents