コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: EricDahlvang/lucy
        private void LoadModel()
        {
            // Trace.TraceInformation("Loading model");
            var model = yamlDeserializer.Deserialize <LucyDocument>(new StringReader(this.editor.Document.Text));

            engine = new LucyEngine(model, useAllBuiltIns: true);
            //recognizer = new LucyRecognizer()
            //{
            //    Model = model,
            //};

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < 100; i++)
            {
                sb.AppendLine(engine.GenerateExample("desireIntent"));
            }
            this.examplesBox.Text = sb.ToString();

            if (engine.Warnings.Any())
            {
                this.error.Content    = String.Join("\n", engine.Warnings);
                this.error.Visibility = Visibility.Visible;
            }
            else
            {
                this.error.Visibility = Visibility.Collapsed;
            }
            lucyModel = this.editor.Document.Text;
        }