Exemple #1
0
 public static void CreateTestSynonyms(this ISynonymsCommand synonymsCommand)
 {
     synonymsCommand.CreateSynonyms(new SynonymGroup {
         Terms = new List <string> {
             "CEO", "Chief Executive Officer"
         }
     });
     synonymsCommand.CreateSynonyms(new SynonymGroup {
         Terms = new List <string> {
             "programmer", "developer"
         }
     });
     synonymsCommand.CreateSynonyms(new SynonymGroup {
         Terms = new List <string> {
             "admin", "administrator"
         }
     });
     synonymsCommand.CreateSynonyms(new SynonymGroup {
         Terms = new List <string> {
             "reception", "receptionist"
         }
     });
     synonymsCommand.CreateSynonyms(new SynonymGroup {
         Terms = new List <string> {
             "PA", "personal assistant"
         }
     });
 }
Exemple #2
0
        /// <summary>
        /// Loads synonyms from comma delimited file.
        /// </summary>
        public static void LoadTestSynonyms(this ISynonymsCommand synonymsCommand, string filePath)
        {
            var synonyms = new Dictionary <Guid, IList <string> >();

            using (var reader = new StreamReader(filePath))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    var parts = line.Split(new [] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length == 2)
                    {
                        IList <string> list;
                        var            id = new Guid(parts[1]);
                        if (!synonyms.TryGetValue(id, out list))
                        {
                            list         = new List <string>();
                            synonyms[id] = list;
                        }

                        list.Add(parts[0]);
                    }
                }
            }

            // Group together.

            var synonymsGroups = from s in synonyms
                                 select new SynonymGroup {
                Id = s.Key, Terms = s.Value
            };

            foreach (var synonymGroup in synonymsGroups)
            {
                synonymsCommand.CreateSynonyms(synonymGroup);
            }
        }
 public SuggestedMembersQuery(ISynonymsCommand synonymsCommand, string ignoredJobTitleWords)
 {
     _synonymsCommand      = synonymsCommand;
     _ignoredJobTitleWords = ignoredJobTitleWords.Split(new[] { ',' }).ToDictionary(s => s.ToLower(), s => s.ToLower());
 }
Exemple #4
0
 public SynonymWordFinder(ISynonymsCommand synonymsCommand)
 {
     _synonymsCommand = synonymsCommand;
 }