/// <summary> /// Method for creating of list of value groups and their corresponding special teasps. /// </summary> /// <param name="dc">user data category</param> /// <returns>List of Value Groups</returns> private (List <ValueGroup>, List <Teasp>) HandleSplitContents(string dc, bool hasPicklist = false) { TBXContentMap cm = mappingDict.GetTBXContentMap(dc); string[] tbx_keys = Methods.GetKeyArray(tbx_picklists.Keys); List <ValueGroup> vgs = new List <ValueGroup>(); List <Teasp> teasps = new List <Teasp>(); foreach (string tbx_dc in mappingDict.GetTBXMappingList(dc)) { if (Array.Exists(tbx_keys, item => item == tbx_dc)) { Teasp teasp = new Teasp(); (string target, string eltAtt) = GetEltTgtEltAtt(tbx_dc); if (hasPicklist) { teasp.SetAll(target, eltAtt, mappingDict.GetPicklistMap(dc)); } else { teasp.SetAll(target, eltAtt); } ValueGroup vg = new ValueGroup(); foreach (string content in cm.Keys) { if (cm[content] == tbx_dc) { vg.Add(content); } } vgs.Add(vg); teasps.Add(teasp); } else { Teasp teasp = new Teasp(); (string target, string eltAtt) = GetEltTgtEltAtt(tbx_dc); teasp.SetAll(target, eltAtt); ValueGroup vg = new ValueGroup(); foreach (string content in cm.Keys) { if (cm[content] == tbx_dc) { vg.Add(content); } } vgs.Add(vg); teasps.Add(teasp); } } return(vgs, teasps); }
private void Display() { lbl_user_dc.Content = datcats[index]; mapControl.Clear(); if (mapping.GetTBXMappingList(datcats[index])?.Count > 0) { mapControl.FillItems(mapping.GetTBXMappingList(datcats[index])); } if (!Array.Exists(indexes_visited, item => item == index.ToString())) { mapControl.FindBest(datcats[index]); indexes_visited[index] = index.ToString(); } UpdateCounter(); }
/// <summary> /// Fills the mappedPicklists Dictionary with a key that is the combination of a data category and a content, and a boolean value. /// <para> /// Any content values which are mapped to TBX data categories which do not have picklists will be skipped. /// </para> /// <para> /// <code>{ 'part of speech_noun' : false }</code> /// </para> /// <para> /// This means that the content "noun" of "part of speech" has not been mapped to a TBX picklist value yet. /// </para> /// </summary> private void FillMappedPicklistsDict() { dcs_with_picklists.ForEach(delegate(string dc) { foreach (string val in mapping.GetContentList(dc)) { string[] keys = Methods.GetKeyArray(tbx_picklists.Keys); if (mapping.GetTBXMappingList(dc).Count < 2 || Array.Exists(keys, item => item == mapping.GetTBXContentMap(dc)?.Get(val))) { try { mappedPicklists.Add(dc + "_" + val, false); } catch (ArgumentException) { continue; } } } }); }