public async Task <IEnumerable <INameModifier> > GetNameModifiers()
        {
            var nameModifiers = new List <INameModifier>();

            var iterations = this.random.Next(0, 10);

            for (int i = 0; i < iterations; i++)
            {
                var modifierIndex = random.Next(0, 5);

                if (modifierIndex == 0)
                {
                    nameModifiers.Add(new ConcatModifier());
                }
                else if (modifierIndex == 1)
                {
                    nameModifiers.Add(new SwapModifier());
                }
                else if (modifierIndex == 2)
                {
                    nameModifiers.Add(new TranslateModifier()
                    {
                        Language = await languageGenerator.Generate("Words", "Visis")
                    });
                }
            }

            return(nameModifiers);
        }
Exemplo n.º 2
0
        private static void processFile(string f, string lang, string title)
        {
            IGraphConsole.WriteLine("Processing file: " + f);

            List <StatisticalGraph> sgList = json_reader.BuildGraphList(f, ops.writeGIF);

            // was there at least one graph in that file?
            if (sgList == null || sgList.Count == 0)
            {
                log.Info("No valid graph to process here.");
            }
            else
            {
                foreach (StatisticalGraph sg in sgList)
                {
                    // Graph cleaning goes first.
                    CleaningManager.CleanGraph(sg);

                    // NLG goes last.
                    if (nlg.Generate(sg))
                    {
                        log.Error("This file has wounded me deeply. Please fix it.");
                    }
                }
            }
        }
Exemplo n.º 3
0
        private static void processFile(string file, string lang, string title)
        {
            string f = Path.GetFullPath(file); // the full path of "file"

            IGraphConsole.WriteLine("Processing file: " + f);

            List <StatisticalGraph> sgList =
                xl_reader.BuildGraphList(f, ops.writeGIF);

            // was there at least one graph in  that Excel file?
            if (sgList == null || sgList.Count == 0)
            {
                log.Info("No valid graph to process here.");
            }
            else
            {
                foreach (StatisticalGraph sg in sgList)
                {
                    if (ops.isCsv)
                    {
                        if (title != null && title.Length > 0)
                        {
                            sg.MainTitle = title;
                        }
                        if (lang != null && lang.Length > 0)
                        {
                            sg.GraphLanguage = lang;
                        }
                    }

                    // Graph cleaning goes first.
                    CleaningManager.CleanGraph(sg);

                    // Writers go second
                    if (ops.writeXML)
                    {
                        log.Debug("Writing graph as XML file.");
                        XMLGraphWriter.write(sg);
                    }

                    // NLG goes last.
                    if (nlg.Generate(sg))
                    {
                        log.Error("This file has wounded me deeply. Please fix it.");
                    }
                }
            }
        }
Exemplo n.º 4
0
        public virtual async Task <string> BindToDataAsync(ITurnContext turnContext, object data)
        {
            if (string.IsNullOrEmpty(this.Template))
            {
                throw new ArgumentNullException(nameof(this.Template));
            }

            LanguageGenerator languageGenerator = turnContext.TurnState.Get <LanguageGenerator>();

            if (languageGenerator != null)
            {
                var result = await languageGenerator.Generate(
                    turnContext,
                    template : Template,
                    data : data).ConfigureAwait(false);

                return(result);
            }

            return(null);
        }
Exemplo n.º 5
0
        public virtual async Task <string> BindAsync(DialogContext dialogContext, object data = null)
        {
            if (string.IsNullOrEmpty(this.Template))
            {
                throw new ArgumentNullException(nameof(this.Template));
            }

            LanguageGenerator languageGenerator = dialogContext.Services.Get <LanguageGenerator>();

            if (languageGenerator != null)
            {
                var result = await languageGenerator.Generate(
                    dialogContext,
                    template : Template,
                    data : data ?? dialogContext.State).ConfigureAwait(false);

                return(result.ToString());
            }

            return(null);
        }