public string[] Transform_EnglishDictionary_StringRepresentation(double[] numbers) { var dictionary = new EnglishDictionary().Create(); var words = new Words(dictionary); return(numbers.Transform(new WordsDecorator <double, string>(words, dictionary))); }
public static void RunTests() { var d = new EnglishDictionary(); var e = new DictionaryEntry("program"); e.Word = "program"; e.Variants = new List <DictionaryVariant>(); var data = new[] { new { R = (int)PartOfSpeech.n, S = (int)NounSubset.Cognition, D = "a series of steps to be carried out or goals to be accomplished" }, new { R = (int)PartOfSpeech.n, S = (int)NounSubset.Cognition, D = "a system of projects or services intended to meet a public need" }, new { R = (int)PartOfSpeech.n, S = (int)NounSubset.Communication, D = "a radio or television show" }, new { R = (int)PartOfSpeech.n, S = (int)NounSubset.Communication, D = "a document stating the aims and principles of a political party" }, new { R = (int)PartOfSpeech.n, S = (int)NounSubset.Communication, D = "an announcement of the events that will occur as part of a theatrical or sporting event" }, new { R = (int)PartOfSpeech.n, S = (int)NounSubset.Communication, D = "an integrated course of academic studies" }, new { R = (int)PartOfSpeech.n, S = (int)NounSubset.Communication, D = "(computer science) a sequence of instructions that a computer can interpret and execute" }, new { R = (int)PartOfSpeech.n, S = (int)NounSubset.Act, D = "a performance (or series of performances) at a public presentation" }, new { R = (int)PartOfSpeech.v, S = (int)VerbSubset.Communication, D = "arrange a program of or for" }, new { R = (int)PartOfSpeech.v, S = (int)VerbSubset.Creation, D = "write a computer program" }, }; DictionaryVariant vn = (PartOfSpeech.n, NounSubset.Cognition, "a series of steps to be carried out or goals to be accomplished"); DictionaryVariant vv = (PartOfSpeech.n, VerbSubset.Unknown, "a series of steps to be carried out or goals to be accomplished"); DictionaryVariant vadv = (PartOfSpeech.n, AdverbSubset.Unknown, "a series of steps to be carried out or goals to be accomplished"); DictionaryVariant vadj = (PartOfSpeech.n, AdjectiveSubset.Unknown, "a series of steps to be carried out or goals to be accomplished"); var e2 = new DictionaryEntry("program", new[]
public void ProcessInput(string input) { logger.LogDebug($"ProcessInput:'{input}'"); TokenCollection collection = input; var sentenceBuilder = new SentenceBuilder(); foreach (var token in collection.TextTokens) { string nomalized = token.Normalize(); var def = EnglishDictionary.Lookup(nomalized); if (def == null) { logger.LogWarn($"Defintion for {nomalized} not found"); } else { logger.LogDebug($"Defintion for {nomalized}: {def.ToJson()}"); sentenceBuilder.Add(def); } } SentenceExecutionOptions executionOptions = sentenceBuilder.BuildOptions(); if (executionOptions.IsExecutable()) { executionOptions.ResolveAndExecute(sentenceBuilder); } }
private void languageInit() { int[] languageCodes = map_language.Keys.ToArray(); int languageCode = -1; foreach (int lc in languageCodes) { if (map_language[lc].Equals(languageName)) { languageCode = lc; break; } } switch (languageCode) { case 1: language = new EnglishDictionary(); break; case 2: language = new RussianDictionary(); break; case 3: language = new PolishDictionary(); break; default: throw new NotExistingDictionaryException(); } }
public RequestFeatureMap(DirectoryInfo baseDir, HttpLogger logger) { _logger = logger; _dict = new EnglishDictionary(); _featureIndex = new FileInfo(Path.Combine(baseDir.FullName, "features.dat")); if (!_featureIndex.Directory.Exists) { _featureIndex.Directory.Create(); } _featureIndexStream = new StreamWriter(new FileStream(_featureIndex.FullName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite), Encoding.ASCII, 1024, false); }
public static void AddLanguage(Dictionary <string, Dictionary <string, string> > LanguageDictionary) { DictionaryList = LanguageDictionary; if (LanguageDictionary.Keys.Contains("English")) { foreach (var item in LanguageDictionary["English"]) { EnglishDictionary.Add(item.Key, item.Value); } } if (LanguageDictionary.Keys.Contains("Chinese")) { foreach (var item in LanguageDictionary["Chinese"]) { ChineseDictionary.Add(item.Key, item.Value); } } }
public static void FindWords( GraphNode <char> node, ICollection <string> words, HashSet <GraphNode <char> > visited, StringBuilder word) { if (EnglishDictionary.IsWord(word.ToString())) { words.Add(word.ToString()); } foreach (GraphNode <char> neighbor in node.Neighbors) { if (!visited.Contains(neighbor)) { visited.Add(neighbor); word.Append(neighbor.Value); FindWords(neighbor, words, visited, word); visited.Remove(neighbor); word.Remove(word.Length - 1, 1); } } }
public string TransformToDifferentWords_Strategy(double number) { var provider = new EnglishDictionary(); return(number.TransformToWords(provider)); }