public void AlineFeatures() { var manner = _featSys.GetFeature <SymbolicFeature>("manner"); var aline = new Aline(_segmentPool, Enumerable.Empty <SymbolicFeature>(), manner.ToEnumerable(), new Dictionary <SymbolicFeature, int> { { manner, 50 } }, new Dictionary <FeatureSymbol, int> { { manner.PossibleSymbols["stop"], 100 }, { manner.PossibleSymbols["affricate"], 95 }, { manner.PossibleSymbols["fricative"], 90 }, { manner.PossibleSymbols["approximant"], 80 } }); _project.WordAligners["primary"] = aline; var pm = new ProjectMigration2(); pm.Migrate(_segmentPool, _project); aline = (Aline)_project.WordAligners["primary"]; Assert.That(aline.RelevantConsonantFeatures.Select(f => f.ID), Is.EquivalentTo(new[] { "manner", "airstream" })); Assert.That(aline.FeatureWeights.Select(kvp => Tuple.Create(kvp.Key.ID, kvp.Value)), Is.EquivalentTo(new[] { Tuple.Create("manner", 50), Tuple.Create("airstream", 5) })); Assert.That(aline.ValueMetrics.Select(kvp => Tuple.Create(kvp.Key.ID, kvp.Value)), Is.EquivalentTo(new[] { Tuple.Create("stop", 100), Tuple.Create("affricate", 95), Tuple.Create("fricative", 90), Tuple.Create("approximant", 80), Tuple.Create("pulmonic", 100), Tuple.Create("ejective", 66), Tuple.Create("implosive", 33), Tuple.Create("click", 0) })); }
public override object UpdateComponent() { var mode = AlignmentMode.Local; switch (_mode) { case AlineMode.Local: mode = AlignmentMode.Local; break; case AlineMode.Global: mode = AlignmentMode.Global; break; case AlineMode.SemiGlobal: mode = AlignmentMode.SemiGlobal; break; case AlineMode.HalfLocal: mode = AlignmentMode.HalfLocal; break; } var relevantVowelFeatures = new List <SymbolicFeature>(); var relevantConsFeatures = new List <SymbolicFeature>(); var featureWeights = new Dictionary <SymbolicFeature, int>(); var valueMetrics = new Dictionary <FeatureSymbol, int>(); foreach (RelevantFeatureViewModel feature in _features) { if (feature.Vowel) { relevantVowelFeatures.Add(feature.DomainFeature); } if (feature.Consonant) { relevantConsFeatures.Add(feature.DomainFeature); } featureWeights[feature.DomainFeature] = feature.Weight; foreach (RelevantValueViewModel value in feature.Values) { valueMetrics[value.DomainSymbol] = value.Metric; } } var aligner = new Aline(_segmentPool, relevantVowelFeatures, relevantConsFeatures, featureWeights, valueMetrics, new AlineSettings { ExpansionCompressionEnabled = _expansionCompressionEnabled, Mode = mode, ContextualSoundClasses = _soundClasses.SoundClasses.Select(nc => nc.DomainSoundClass), SoundChangeScoringEnabled = _soundChangeScoringEnabled, SyllablePositionCostEnabled = _syllablePositionCostEnabled }); _projectService.Project.WordAligners[ComponentIdentifiers.PrimaryWordAligner] = aligner; return(aligner); }
//These are the functions that the Agent can execute /// <summary> /// This is a Mediaroom Specific function. /// </summary> /// <param name="state"></param> private void AdminService() { if (File.Exists(@"c:\Program Files\Microsoft IPTV Services\InstallTools\AdminService.exe")) { try { string command = "\"c:\\Program Files\\Microsoft IPTV Services\\InstallTools\\AdminService.exe\"" + Job2Do.TaskOptions; GV.CurrentActionForLog = "Executing " + command; System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command); bool tasksuccess = true; // The following commands are needed to redirect the standard output. // This means that it will be redirected to the Process.StandardOutput StreamReader. procStartInfo.RedirectStandardOutput = true; procStartInfo.UseShellExecute = false; // Do not create the black window. procStartInfo.CreateNoWindow = true; // Now we create a process, assign its ProcessStartInfo and start it System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo = procStartInfo; proc.Start(); // Get the output into a string string result = proc.StandardOutput.ReadToEnd(); Job2Do.status = "Execution:Completed"; Dictionary <string, string> resulting = new Dictionary <string, string>(); resulting.Add(Job2Do.Target, result); GV.CurrentActionForLog = "AdminService " + Job2Do.TaskOptions + " completed:\n" + result; Job2Do.taskdetails = new Dictionary <string, string>(); //Need to tidy up the returned results! string[] All_Lines = result.Split(new Char[] { '\n' }); bool grabnextline = false; string currentserver = ""; //Job2Do.taskdetails.Add("Adminservice Output: \n", result); //Set the serverip when we comes across it. foreach (string Aline in All_Lines) { //Set the serverip when we comes across it. if (Aline.StartsWith("####")) { grabnextline = true; continue; } if (grabnextline) { grabnextline = false; if (Aline.Length < 2) { continue; } currentserver = Aline; if (!Job2Do.taskdetails.Keys.Contains(currentserver)) { Job2Do.taskdetails.Add(currentserver, ""); } } // If Service status is called out, we want to add to the dictionary details for that server if (Aline.StartsWith("Service")) { Job2Do.taskdetails[currentserver] += Aline + "\n"; } else { if (Aline.StartsWith("System.InvalidOperation")) { Job2Do.taskdetails[currentserver] += Aline + "\n"; tasksuccess = false; } } } // End tidiness Job2Do.tasksummary = "Adminservice: " + Job2Do.TaskOptions + " Completed"; if (tasksuccess) { Job2Do.TaskStatusColor = "Green"; } else { Job2Do.TaskStatusColor = "Red"; } Job2Do.timecompleted = DateTime.Now; string whoami = WindowsIdentity.GetCurrent().Name; //Job2Do.taskdetails.Add("Running as",whoami); //Job2Do.taskdetails.Add("Unparsed Output",result); } catch { } } else { Job2Do.status = "Completed"; Job2Do.TaskStatusColor = "LightGreen"; Job2Do.taskdetails = new Dictionary <string, string>(); Job2Do.tasksummary = "No Adminservice to run"; Job2Do.timecompleted = DateTime.Now; } }