Locked segments and Cross file Repetitions

Sorry, I know, there are other posts ..... but I try again Embarrassed.

Someone knows a way to get the words for Locked segments and Cross file repetitions?

..... and also.... is there a way to setup via code the parameter 'Lock 100%" and log the locked segments as different category?

thanks in advance

Luca

  • I'm not sure about locked strings but cross file reps are in the xml log.

    That function (as an example) will get for you html table with total summary  divided into normal reps, cross file reps and normal and internal fuzzy:

    private static string AddClientQuoteSummary(FileBasedProject project,  TargetLanguageStatistics analysis_stats, DataTable dt_client)

           {

               string result = "";

               string project_file = project.FilePath;

               string ReportsFolder = project_file.Replace(Path.GetFileName(project_file), "Reports");

               if (Directory.Exists(ReportsFolder))

               {

                   string[] files = Directory.GetFiles(ReportsFolder, "Analyze*.xml", SearchOption.TopDirectoryOnly);

                   string xmlfile = files[0];

                   XmlDocument doc = new XmlDocument();

                   doc.XmlResolver = null;

                   doc.Load(xmlfile);

                   doc.Save(xmlfile);

                   doc.Load(xmlfile);

                   XmlNodeList n1 = doc.SelectNodes("/task/batchTotal/analyse/perfect");

                   iTracTools.Log.Info(String.Format("File: {0}, childnode: {1}, count: {2}", xmlfile, doc.ChildNodes[0].Name, n1[0].Name));

                   XmlNode perfect_node = doc.SelectSingleNode("/task/batchTotal/analyse/perfect");

                   XmlNode context_node = doc.SelectSingleNode("/task/batchTotal/analyse/inContextExact");

                   XmlNode exact_node = doc.SelectSingleNode("/task/batchTotal/analyse/exact");

                   XmlNode cross_file_rep_node = doc.SelectSingleNode("/task/batchTotal/analyse/crossFileRepeated");

                   XmlNode rep_node = doc.SelectSingleNode("/task/batchTotal/analyse/repeated");

                   XmlNode new_node = doc.SelectSingleNode("/task/batchTotal/analyse/new");

                   decimal client_perfect_segments = decimal.Parse(perfect_node.Attributes["segments"].Value);

                   decimal client_perfect_words = decimal.Parse(perfect_node.Attributes["words"].Value);

                   decimal client_context_segments = decimal.Parse(context_node.Attributes["segments"].Value);

                   decimal client_context_words = decimal.Parse(context_node.Attributes["words"].Value);

                   decimal client_exact_segments = decimal.Parse(exact_node.Attributes["segments"].Value);

                   decimal client_exact_words = decimal.Parse(exact_node.Attributes["words"].Value);

                   decimal client_cross_file_rep_seg = decimal.Parse(cross_file_rep_node.Attributes["segments"].Value);

                   decimal client_cross_file_rep_words = decimal.Parse(cross_file_rep_node.Attributes["words"].Value);

                   decimal client_rep_segments = decimal.Parse(rep_node.Attributes["segments"].Value);

                   decimal client_rep_words = decimal.Parse(rep_node.Attributes["words"].Value);

                   decimal new_words = decimal.Parse(new_node.Attributes["words"].Value);

                   decimal new_segments = decimal.Parse(new_node.Attributes["segments"].Value);

                   //finalizing context and reps

                   decimal client_final_context_words = client_perfect_words + client_context_words;

                   decimal client_final_context_segments = client_context_segments + client_perfect_segments;

                   decimal client_final_reps_seg = client_cross_file_rep_seg + client_rep_segments;

                   decimal client_final_reps_words = client_cross_file_rep_words + client_rep_words;

                   DataRow client_row = dt_client.NewRow();

                   client_row["Language"] = analysis_stats.TargetLanguage.DisplayName;

                   client_row["ContextMatch"] = client_final_context_words.ToString();

                   client_row["Repetitions"] = client_final_reps_words.ToString();

                   client_row["100% Match"] = client_exact_words.ToString();

                   client_row["New Words"] = new_words;

                   //adding non fuzzies to datatable

                   //fuzzies

                   result += "<table border=\"1\" bordercolor=\"black\">";

                   decimal client_fuzzy_total = 0;

                   result += "<tr><td>Type</td><td>Segments</td><td>Words</td></tr>";

                   result += String.Format("<tr><td>Context</td><td>{0}</td><td>{1}</td></tr>",

                       client_final_context_segments, client_final_context_words);

                   result += String.Format("<tr><td>Repetitions</td><td>{0}</td><td>{1}</td></tr>", client_final_reps_seg, client_final_reps_words);

                   result += String.Format("<tr><td>100% Matches</td><td>{0}</td><td>{1}</td></tr>", client_exact_segments, client_exact_words);

                   XmlNodeList normal_fuzzy_list = doc.SelectNodes("/task/batchTotal/analyse/fuzzy");

                   for (int i = normal_fuzzy_list.Count - 1; i >= 0; i--)

                   {

                       XmlNode node = normal_fuzzy_listIdea;

                       result += String.Format("<tr><td>Normal Fuzzy: {0}-{1}</td><td>{2}</td><td>{3}</td></tr>", node.Attributes["max"].Value, node.Attributes["min"].Value,

                           node.Attributes["segments"].Value, node.Attributes["words"].Value);

                       client_fuzzy_total = client_fuzzy_total + decimal.Parse(node.Attributes["words"].Value);

                   }

                   client_row["Fuzzies"] = client_fuzzy_total;

                   dt_client.Rows.Add(client_row);

                   XmlNodeList internal_fuzzy_nodes = doc.SelectNodes("/task/batchTotal/analyse/internalFuzzy");

                   for (int i = internal_fuzzy_nodes.Count - 1; i >= 0; i--)

                   {

                       XmlNode node = internal_fuzzy_nodesIdea;

                       result += String.Format("<tr><td><font color=\"Red\">Internal Fuzzy: {0}-{1}</font></td><td><font color=\"Red\">{2}</font></td><td><font color=\"Red\">{3}</font></td></tr>", node.Attributes["max"].Value, node.Attributes["min"].Value,

                           node.Attributes["segments"].Value, node.Attributes["words"].Value);

                   }

                   iTracTools.Log.Info(String.Format("Internal fuzyy: {0}, normal fuzzy {1}", internal_fuzzy_nodes.Count, normal_fuzzy_list.Count));

                   result += String.Format("<tr><td>New</td><td>{0}</td><td>{1}</td></tr>", new_segments, new_words);

                   result += "</table>";

               }

               return result;

           }