예제 #1
0
        public void SaveSynonym(Synonym synonym)
        {
            var synonymsToSave = parser.GetAllSynonymObjectsFromSynonym(synonym);

            foreach (var synonymItem in synonymsToSave)
            {
                repository.SaveSynonym(synonymItem);
            }
            ;
        }
예제 #2
0
        public IEnumerable <Synonym> GetAllSynonymObjectsFromSynonym(Synonym synonym)
        {
            _ = synonym ?? throw new ArgumentNullException($"{nameof(synonym)} cannot be null");
            List <Synonym> synonyms = new List <Synonym>();

            synonyms.Add(synonym);
            synonyms.AddRange(synonym.Synonyms.Split(',').Select(x => new Synonym {
                Term = x, Synonyms = synonym.Term
            }).ToList());
            return(synonyms);
        }