public ProviderInfoForThread(string word, string codeForm, string codeTo, IDictionaryProvider provider) { m_word = word; m_codeForm = codeForm; m_codeTo = codeTo; m_Provider = provider; }
/// <summary> /// Initializes a new instance of the <see cref="DictionaryLoader"/> class. /// </summary> /// <param name="wordListService">Used to construct the wordlist contained in /// the <see cref="IDictionaryProvider.Dictionaries"/>.</param> /// <param name="dictionaryConfiguration">The dictionary configuration.</param> public DictionaryLoader( IWordListCreator wordListService, IDictionaryProvider dictionaryConfiguration) { this.wordListService = wordListService; this.dictionaryConfiguration = dictionaryConfiguration; isFullyInitialized = false; }
public SiteMapModifyService( ISiteMapProvider siteMapProvider, IDictionaryProvider dictionaryProvider, IQpDataProvider qpDataProvider, ISettingsProvider settingsProvider, IMapper mapper) { _siteMapProvider = siteMapProvider; _dictionaryProvider = dictionaryProvider; _qpDataProvider = qpDataProvider; _settingsProvider = settingsProvider; _mapper = mapper; }
public FormMain(IDictionaryProvider provider) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } m_Provider = provider; m_Words = provider.Load(); InitializeComponent(); RefreshCounts(); }
public SiteMapService( ISiteMapProvider siteMapProvider, IWidgetProvider widgetProvider, IDictionaryProvider dictionaryProvider, ISettingsProvider settingsProvider, IItemExtensionProvider itemExtensionProvider, IMapper mapper, ILogger <SiteMapService> logger) { _siteMapProvider = siteMapProvider; _widgetProvider = widgetProvider; _dictionaryProvider = dictionaryProvider; _settingsProvider = settingsProvider; _itemExtensionProvider = itemExtensionProvider; _mapper = mapper; _logger = logger; }
public static string TransformToWords(this double number, IDictionaryProvider provider) { bool flag = provider.SpecialKeys.TryGetValue(number, out string result); if (flag) { return(result); } string value = number.ToString(System.Globalization.CultureInfo.InvariantCulture); StringBuilder builder = new StringBuilder(); foreach (var t in value) { builder.Append($"{provider.Keys[t]} "); } result = builder.ToString(); return(result); }
/// <summary > /// Algorith for converting double in its "verbal format". /// </summary > /// <param name = " number " > number for convirting. </param > /// <param name = " provider " > interface for working with dictionaries. </param > /// <returns>Verbal format of number. </returns> public static string TransformToWords(this double number, IDictionaryProvider provider) { if (provider == null) { throw new ArgumentNullException(nameof(provider), "must not be null"); } bool flag = provider.SpecialKeys.TryGetValue(number, out string result); if (flag) { return(result); } char[] array = number.ToString().ToCharArray(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.Length - 1; i++) { builder.Append($"{provider.Keys[array[i]]} "); } builder.Append($"{provider.Keys[array[^1]]}");
public static Task <List <FileInfo> > CollectVocabTagFilesAsync(this IDictionaryProvider dictionaryProvider) => dictionaryProvider.CollectFilesAsync(DictionaryConstants.Names.Vocab, "tag_bank_");
public PathFinder(IDictionaryProvider dictionaryProvider, IOutputProvider outputProvider) { _dictionaryProvider = dictionaryProvider; _outputProvider = outputProvider; }
public static Task <List <FileInfo> > CollectKanjiFilesAsync(this IDictionaryProvider dictionaryProvider) => dictionaryProvider.CollectFilesAsync(DictionaryConstants.Names.Kanji, "kanji_bank_");
public CultureService(IDictionaryProvider dictionaryProvider, IMapper mapper) { _dictionaryProvider = dictionaryProvider; _mapper = mapper; }
public VocabDictionaryService( IDictionaryProvider dictionaryProvider) { _dictionaryProvider = dictionaryProvider; }
public static Task <FileInfo> GetSimilarNotoFileAsync(this IDictionaryProvider dictionaryProvider) => dictionaryProvider.GetFileAsync("noto.json");
public SimilarNotoDictionaryService( IDictionaryProvider dictionaryProvider) { _dictionaryProvider = dictionaryProvider; }
public ItemDifinitionService(IDictionaryProvider dictionaryProvider, IMapper mapper) { _dictionaryProvider = dictionaryProvider; _mapper = mapper; }
public AnagramProvider(IDictionaryProvider dictionaryProvider) { if (dictionaryProvider == null) throw new ArgumentNullException("dictionaryProvider"); _dictionaryProvider = dictionaryProvider; }
// ViewForDictionary(IDictionaryProvider dictionaryProvider) public DictionaryProviderViewForList(Type dictionaryProvider) { this.dictionaryProvider = (IDictionaryProvider)Activator.CreateInstance(dictionaryProvider); }
public FixedLengthDictionaryProvider(IDictionaryProvider dictionaryProvider, int length) { _dictionaryProvider = dictionaryProvider; _length = length; }
public RegionService(IDictionaryProvider dictionaryProvider, ISettingsProvider settingsProvider, IMapper mapper) { _dictionaryProvider = dictionaryProvider; _settingsProvider = settingsProvider; _mapper = mapper; }
public String GetContents(string word, string codeForm, string codeTo) { List <IDictionaryProvider> dictionaries = new List <IDictionaryProvider>(); foreach (Type type in GlobalOptions.WorkedDictionaries) { IDictionaryProvider provider = (IDictionaryProvider)Activator.CreateInstance(type); //TODO: здесь бы вставить и проверку поддержки языка if (!provider.OnlyAsUrlProvider) { dictionaries.Add(provider); } } if (string.IsNullOrEmpty(word)) { return(""); } string fileName = GetFileName(word, codeForm, codeTo); // if (File.Exists(fileName)) return fileName; // if (!WWW.IsOnline()) return ""; threads.Clear(); string body = ""; foreach (DictionaryProvider provider in dictionaries) { ProviderInfoForThread ex = new ProviderInfoForThread(word, codeForm, codeTo, provider); Thread th = new Thread(ex.Execute) { }; th.Name = string.Format("{0} provider for word '{1}'", provider.Title, word); threads.Add(th); th.Start(); } WaitUntilFinished(); foreach (DictionaryProvider provider in dictionaries) { string content = provider.GetContent(word, codeForm, codeTo); if (string.IsNullOrEmpty(content)) { continue; } DictionaryProvider.ResultFromResponse res = provider.LastResultFromResponse; if (res != null) { body += string.Format(ArticleReferenceTemplate, res.LastURL, provider.Title, res.Content, res.AcceptedLanguageCode); } } if (string.IsNullOrEmpty(body)) { if (File.Exists(fileName)) { return(fileName); } return(""); } string s = HtmlFileTemplate.Replace("{0}", word); s = s.Replace("{1}", body); FileManager.CreateFile(fileName, s); return(fileName); }
public SimilarKeiseiDictionaryService( IDictionaryProvider dictionaryProvider) { _dictionaryProvider = dictionaryProvider; }
public KradFileProvider( IDictionaryProvider dictionaryProvider) { _dictionaryProvider = dictionaryProvider; }
public static Task <FileInfo> GetRadkFile2Async(this IDictionaryProvider dictionaryProvider) => dictionaryProvider.GetFileAsync("kradzip/radkfile2");
public static Task <FileInfo> GetNiaiSimilarRadicalsAsync(this IDictionaryProvider dictionaryProvider) => dictionaryProvider.GetFileAsync("niai/similar-radicals.txt");
public static Task<FileInfo> GetSimilarKeiseiFileAsync(this IDictionaryProvider dictionaryProvider) => dictionaryProvider.GetFileAsync("from_keisei.json");
public KanjiDictionaryService( IDictionaryProvider dictionaryProvider) { _dictionaryProvider = dictionaryProvider; }
public static Task <List <FileInfo> > CollectVocabFrequencyFilesAsync(this IDictionaryProvider dictionaryProvider) => dictionaryProvider.CollectFilesAsync(DictionaryConstants.Names.Frequency, "term_meta_bank_");
public NiaiFileProvider( IDictionaryProvider dictionaryProvider) { _dictionaryProvider = dictionaryProvider; }
public ProcessRunner(IDictionaryProvider dictionaryProvider, IShortestPathCalculator shortestPathCalculator, IResultProcessor resultProcessor) { _dictionaryProvider = dictionaryProvider; _shortestPathCalculator = shortestPathCalculator; _resultProcessor = resultProcessor; }
public FrequencyDictionaryService( IDictionaryProvider dictionaryProvider) { _dictionaryProvider = dictionaryProvider; }
public static Task <FileInfo> GetKradFileAsync(this IDictionaryProvider dictionaryProvider) => dictionaryProvider.GetFileAsync("kradzip/kradfile");