Beispiel #1
0
        public ShabdkoshService(ITextFileRepository fileRepository, ITextOperation textOperation)
        {
            _textOperation = textOperation;
            string text = fileRepository.ReadTextFile();

            occuranceOfAWord = _textOperation.Text2DictWordOccurance(text);
        }
Beispiel #2
0
        public async Task <Shabd> Handle(FindDefinitionByKeywordQuery request, CancellationToken cancellationToken)
        {
            var word             = request.Keyword.ToLower();
            var result           = fileRepository.ReadTextFile();
            var occuranceOfAWord = _textOperation.Text2DictWordOccurance(result);

            return(result != null ? new Shabd
            {
                Word = word,
                Occurance = occuranceOfAWord[word],
                Definition = await _textOperation.GetDefinitionAsync(word)
            } : null);
        }