restore conflict solving
Browse files
utils.py
CHANGED
@@ -46,20 +46,20 @@ def align_text(txt1: str, txt2: str, lang1: str, lang2: str) -> pd.DataFrame:
|
|
46 |
normalize_embeddings=True,
|
47 |
show_progress_bar=True)
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
steps = 3
|
54 |
batch_id = -1
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
|
61 |
-
|
62 |
-
|
63 |
|
64 |
paragraphs_dict, par_ids, meta_info, sent_counter_dict = reader.get_paragraphs(db_path)
|
65 |
|
|
|
46 |
normalize_embeddings=True,
|
47 |
show_progress_bar=True)
|
48 |
|
49 |
+
conflicts_to_solve, rest = resolver.get_all_conflicts(db_path, min_chain_length=2, max_conflicts_len=6, batch_id=-1)
|
50 |
+
resolver.get_statistics(conflicts_to_solve)
|
51 |
+
resolver.get_statistics(rest)
|
52 |
|
53 |
steps = 3
|
54 |
batch_id = -1
|
55 |
|
56 |
+
for i in range(steps):
|
57 |
+
conflicts, rest = resolver.get_all_conflicts(db_path, min_chain_length=2 + i, max_conflicts_len=6 * (i + 1), batch_id=batch_id)
|
58 |
+
resolver.resolve_all_conflicts(db_path, conflicts, model_name, show_logs=False)
|
59 |
+
#vis_helper.visualize_alignment_by_db(db_path, output_path="img_test1.png", lang_name_from=lang1, lang_name_to=lang2, batch_size=400, size=(600, 600), plt_show=True)
|
60 |
|
61 |
+
if len(rest) == 0:
|
62 |
+
break
|
63 |
|
64 |
paragraphs_dict, par_ids, meta_info, sent_counter_dict = reader.get_paragraphs(db_path)
|
65 |
|