Пример #1
0
        static void Main(string[] args)
        {
            using var httpClient = new HttpClient();
            httpClient.Timeout   = TimeSpan.FromSeconds(5);

            var dictionaryApi = new DictionaryApi(httpClient);

            var wordRequest = new DictionaryRequest
            {
                LanguageCode = args[0],
                Word         = args[1]
            };
            var wordResponse = dictionaryApi.GetWord(wordRequest);

            if (!wordResponse.Found)
            {
                C.WriteLine("The word/dictionary does not exist in this dictionary");
                return;
            }

            C.WriteLine(wordResponse.Word.WordName);
            foreach (var meaning in wordResponse.Word.Meanings)
            {
                C.WriteLine($"- Meaning's part of speech: {meaning.PartOfSpeech}");
                foreach (var definition in meaning.Type)
                {
                    C.WriteLine($"-- Definition: {definition.Definition}");
                    C.WriteLine($"-- Example: {definition.Example}");
                }
            }
        }
Пример #2
0
        public async Task ResultNotEmptyTest(string word, string language, bool fallback)
        {
            // Act
            var results = await DictionaryApi.GetDefinitionsAsync(word, language, fallback);

            // Assert
            Assert.NotEmpty(results);
        }
Пример #3
0
 static ApiRouter()
 {
     Projects            = new ProjectsApi();
     ProjectFolders      = new ProjectFoldersApi();
     ProjectGroups       = new ProjectGroupsApi();
     ProjectTypes        = new ProjectTypesApi();
     Participants        = new ParticipantsApi();
     Dictionary          = new DictionaryApi();
     Casebook            = new CasebookApi();
     ProjectCustomValues = new ProjectCustomValuesApi();
     CalculationFormulas = new CalculationFormulasApi();
     Responsibles        = new ResponsiblesApi();
     Currencies          = new CurrenciesApi();
 }
Пример #4
0
 public Synonymizer(IKeywordExtractor extractor, DictionaryApi api) : this(extractor)
 {
     Api = api;
 }
Пример #5
0
 public Synonymizer(IKeywordExtractor extractor)
 {
     KeywordExtractor = extractor;
     Api = new DictionaryApi();
 }