示例#1
0
        public override string GetNaturalLanguage()
        {
            string ifText;

            if (slot.Contents == null)
            {
                ifText = "if some condition is true, then";
            }
            else
            {
                ifText = String.Format("if {0}, then", slot.GetNaturalLanguage());
            }

            string thenText;

            if (spine.IsEmpty)
            {
                thenText = " something happens";
            }
            else
            {
                thenText = " " + spine.GetNaturalLanguage();
            }

            return(ifText + thenText);
        }
示例#2
0
        public override string GetNaturalLanguage()
        {
            string whileText = slot.GetNaturalLanguage();
            string doText    = consequenceSpine.GetNaturalLanguage();

            return(String.Format("this happens: {0}... and then keeps happening until {1}", doText, whileText));
        }
示例#3
0
        public override string GetNaturalLanguage()
        {
            string whileText = slot.GetNaturalLanguage();
            string doText    = consequenceSpine.GetNaturalLanguage();

            return(String.Format("while {0}, {1}", whileText, doText));
        }
示例#4
0
        public string GetNaturalLanguage()
        {
            string triggerNL = triggerSlot.GetNaturalLanguage();
            string spineNL   = spine.GetNaturalLanguage();

            if (triggerNL == "some event" && spineNL == "nothing happens")
            {
                return(String.Empty);
            }

            else
            {
                System.Text.StringBuilder code = new System.Text.StringBuilder();

                if (triggerNL != "some event")
                {
                    code.AppendLine(triggerNL + ":");
                }

                if (spineNL != String.Empty)
                {
                    try {
                        // Capitalise:
                        string firstCharacter = spineNL.Substring(0, 1).ToUpper();
                        if (spineNL.Length == 1)
                        {
                            spineNL = firstCharacter;
                        }
                        else
                        {
                            spineNL = firstCharacter + spineNL.Substring(1, spineNL.Length - 1);
                        }
                    }
                    catch (Exception) {
                        spineNL = spine.GetNaturalLanguage();
                    }

                    code.Append(spineNL + ".");
                }

                return(code.ToString());
            }
        }
示例#5
0
        public override string GetNaturalLanguage()
        {
            string ifText;

            if (slot.Contents == null)
            {
                ifText = "if some condition is true, then";
            }
            else
            {
                ifText = String.Format("if {0}, then", slot.GetNaturalLanguage());
            }

            string thenText;

            if (consequenceSpine.IsEmpty)
            {
                thenText = " something happens, otherwise";
            }
            else
            {
                thenText = String.Format(" {0}, otherwise", consequenceSpine.GetNaturalLanguage());
            }

            string elseText;

            if (alternativeSpine.IsEmpty)
            {
                elseText = " something else happens";
            }
            else
            {
                elseText = " " + alternativeSpine.GetNaturalLanguage();
            }

            return(ifText + thenText + elseText);
        }