From ddd1df458f416c2437514a0a58a5b4ecf2a8a268 Mon Sep 17 00:00:00 2001 From: linlin Date: Tue, 6 Oct 2020 17:29:20 +0200 Subject: [PATCH] New translations misc.py (French) --- lang/fr/gklearn/ged/util/misc.py | 129 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 lang/fr/gklearn/ged/util/misc.py diff --git a/lang/fr/gklearn/ged/util/misc.py b/lang/fr/gklearn/ged/util/misc.py new file mode 100644 index 0000000..457d276 --- /dev/null +++ b/lang/fr/gklearn/ged/util/misc.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Thu Mar 19 18:13:56 2020 + +@author: ljia +""" +from gklearn.utils import dummy_node + + +def construct_node_map_from_solver(solver, node_map, solution_id): + node_map.clear() + num_nodes_g = node_map.num_source_nodes() + num_nodes_h = node_map.num_target_nodes() + + # add deletions and substitutions + for row in range(0, num_nodes_g): + col = solver.get_assigned_col(row, solution_id) + if col >= num_nodes_h: + node_map.add_assignment(row, dummy_node()) + else: + node_map.add_assignment(row, col) + + # insertions. + for col in range(0, num_nodes_h): + if solver.get_assigned_row(col, solution_id) >= num_nodes_g: + node_map.add_assignment(dummy_node(), col) + + +def options_string_to_options_map(options_string): + """Transforms an options string into an options map. + + Parameters + ---------- + options_string : string + Options string of the form "[--