master > master: code py - minor
This commit is contained in:
parent
9c5b88b64d
commit
954becea26
@ -47,12 +47,10 @@ def enter():
|
||||
# X = 'ANSTRENGEN',
|
||||
# Y = 'AGAT',
|
||||
# X = 'ACGAAG',
|
||||
Y = 'applses',
|
||||
X = 'happily ever, lol',
|
||||
# Y = 'apple',
|
||||
X = 'happily',
|
||||
Y = 'apple',
|
||||
# X = 'happily',
|
||||
# Y = 'nei wolle elli wien',
|
||||
# X = 'nie will elli wein',
|
||||
verbose = True,
|
||||
);
|
||||
return;
|
||||
|
@ -26,8 +26,9 @@ __all__ = [
|
||||
|
||||
class Directions(Enum):
|
||||
UNSET = -1;
|
||||
DIAGONAL = 1;
|
||||
HORIZONTAL = 0;
|
||||
# Prioritäten hier setzen
|
||||
DIAGONAL = 0;
|
||||
HORIZONTAL = 1;
|
||||
VERTICAL = 2;
|
||||
|
||||
def gap_penalty(x: str):
|
||||
@ -87,6 +88,9 @@ def hirschberg_algorithm_step(
|
||||
Costs, Moves = compute_cost_matrix(X = '-' + X, Y = '-' + Y);
|
||||
path = reconstruct_optimal_path(Moves=Moves);
|
||||
word_x, word_y = reconstruct_words(X = '-' + X, Y = '-' + Y, moves=[Moves[coord] for coord in path], path=path);
|
||||
# if verbose:
|
||||
# repr = display_cost_matrix(Costs=Costs, path=path, X = '-' + X, Y = '-' + Y);
|
||||
# print(f'\n\x1b[1mRekursionstiefe: {depth}\x1b[0m\n\n{repr}')
|
||||
return [word_x], [word_y];
|
||||
else:
|
||||
n = int(np.ceil(n/2));
|
||||
@ -123,6 +127,7 @@ def hirschberg_algorithm_step(
|
||||
# Divide and Conquer ausführen:
|
||||
alignments_x_1, alignments_y_1 = hirschberg_algorithm_step(X=X[:p], Y=Y[:n], depth=depth+1, verbose=verbose);
|
||||
alignments_x_2, alignments_y_2 = hirschberg_algorithm_step(X=X[p:], Y=Y[n:], depth=depth+1, verbose=verbose);
|
||||
|
||||
# Resultate zusammensetzen:
|
||||
alignments_x = alignments_x_1 + alignments_x_2;
|
||||
alignments_y = alignments_y_1 + alignments_y_2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user