private void Load(IEnumerable <SynonymViewModel> synonyms) { foreach (var synonym in synonyms) { Synonyms.Add(synonym); } }
/// <summary> /// /// </summary> /// <param name="synonymInfo"></param> public static void AddSynonym(SynonymInfo synonymInfo) { if (synonymInfo != null) { Synonyms.Add(synonymInfo); } }
public void Test1() { var synonyms = new Synonyms(new Dictionary<string, string>()); synonyms.Add("mssql", "ms-sql"); var result = synonyms.FindCoreSynonym("mssql"); Assert.AreEqual("mssql", result); }
public async Task GetSynonyms() { using (WebClient client = new WebClient()) { try { GetHtmlHelper[3].PageContent = client.DownloadString($"{GetHtmlHelper[3].Uri}{GetHtmlHelper[3].VocText}"); } catch (Exception) { } } Synonyms.Clear(); while (GetHtmlHelper[3].PageContent != null && GetHtmlHelper[3].PageContent.Contains(GetHtmlHelper[3].Key)) { GetHtmlHelper[3].Text = ""; GetHtmlHelper[3].StartIndex = GetHtmlHelper[3].PageContent.IndexOf(GetHtmlHelper[3].Key) + GetHtmlHelper[3].Key.Length; GetHtmlHelper[3].Text = GetHtmlHelper[3].PageContent.Substring(GetHtmlHelper[3].StartIndex); GetHtmlHelper[3].EndIndex = GetHtmlHelper[3].Text.IndexOf(GetHtmlHelper[3].KeyEnd); GetHtmlHelper[3].PageContent = GetHtmlHelper[3].Text; GetHtmlHelper[3].Text = GetHtmlHelper[3].Text.Substring(0, GetHtmlHelper[3].EndIndex); Synonyms.Add(GetHtmlHelper[3].Text.Trim()); } }
public void setSynonymValues() { Synonyms.Clear(); foreach (var i in SynResult.results) { foreach (var j in i.lexicalEntries) { var synonym = new Synonym(); synonym.Type = j.lexicalCategory; synonym.SynonymItems = ""; foreach (var k in j.entries) { foreach (var l in k.senses) { foreach (var item in l.synonyms) { synonym.SynonymItems += "\n" + item.text; Console.WriteLine(); } } } Synonyms.Add(synonym); } } }
public virtual void Invoke(Func <string, string> func) { if (null == func) { throw new ArgumentNullException("func"); } CanonicalForm = func.Invoke(CanonicalForm); var synonyms = Synonyms.ToList(); Synonyms.Clear(); foreach (var synonym in synonyms.OrderBy(x => x)) { Synonyms.Add(func.Invoke(synonym)); } }
public void Add(string name, DataType type, string[] synonyms) { TypeMapItem item; foreach (var syn in synonyms) { if (Synonyms.ContainsKey(syn.ToLower())) { throw new ExpressionException("Synonym '" + syn + "' already added to type map"); } } if (!Items.ContainsKey(name.ToLower())) { item = Items[name.ToLower()] = new TypeMapItem { Name = name, DataType = type, Synonyms = synonyms.ToList() }; } else { item = Items[name.ToLower()]; item.Synonyms.AddRange(synonyms); } foreach (var syn in synonyms) { if (!Synonyms.ContainsKey(syn.ToLower())) { Synonyms.Add(syn.ToLower(), item); } } if (!Synonyms.ContainsKey(name.ToLower())) { Synonyms.Add(name.ToLower(), item); } }
protected override void DefineSynonymsAndCommonTerms() { Synonym limited = new Synonym(new List <string>() { "limited", "ltd", "ltd." }); Synonyms.Add(limited); Synonym company = new Synonym(new List <string>() { "company", "co", "co." }); Synonyms.Add(company); CommonTerms.Add(new CommonTerm(limited, 0.25)); CommonTerms.Add(new CommonTerm(company, 0.5)); CommonTerms.Add(new CommonTerm(new Word("plc"), 0.5)); CommonTerms.Add(new CommonTerm(new Word("compliance"), 0.5)); CommonTerms.Add(new CommonTerm(new Word("weee"), 0.5)); CommonTerms.Add(new CommonTerm(new Word("scheme"), 0.5)); CommonTerms.Add(new CommonTerm(new Word("pcs"), 0.5)); }
private async void SynonymClick(string obj) { Translations.Clear(); Synonyms.Clear(); Antonyms.Clear(); Sentences.Clear(); var reply = await new OxfordDictionaryMVVMService().GetSynonymAsync(chosenSrc, obj); if (reply != null) { foreach (var result in reply.results) { foreach (var lexicalEntry in result.lexicalEntries) { foreach (var entry in lexicalEntry.entries) { foreach (var sense in entry.senses) { foreach (var synonym in sense.synonyms) { Synonyms.Add(synonym.text); } } } } } } // exception handling else if (ChosenSrc == null) { var messageDialog = new MessageDialog("Choose a source language!") { Title = "Error" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } else if (ChosenSrc.ToString() != "en") { var messageDialog = new MessageDialog("Synonyms are not supported in this language at present.") { Title = "Warning" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } else { var messageDialog = new MessageDialog("There is no synonym for that word!") { Title = "Warning" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } }