Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            PluginEnvironment plugenv = new PluginEnvironment(new MainClass());
            string plugbase = "/Users/jrising/projects/virsona/plugins/data";
            plugenv.Initialize(plugbase + "/config.xml", plugbase, new NameValueCollection());

            // Test 1: POS Tagging
            POSTagger tagger = new POSTagger(plugenv);
            List<KeyValuePair<string, string>> tagged = tagger.TagList(StringUtilities.SplitWords("This is a test.", false));
            foreach (KeyValuePair<string, string> kvp in tagged)
                Console.WriteLine(kvp.Key + ": " + kvp.Value);

            // Test 2: Grammar parsing
            GrammarParser parser = new GrammarParser(plugenv);
            IParsedPhrase before = parser.Parse("This is a rug and a keyboard.");
            Console.WriteLine(before.ToString());

            // Test 3: Paraphrasing
            Random randgen = new Random();
            IParsedPhrase after = parser.Paraphrase(before, null, null, randgen.NextDouble());
            Console.WriteLine(after.Text);

            // Test 4: Look up some indices
            WordNetAccess wordnet = new WordNetAccess(plugenv);
            Console.WriteLine("Synonyms: " + string.Join(", ", wordnet.GetExactSynonyms("rug", WordNetAccess.PartOfSpeech.Noun).ToArray()));

            // Test 5: Pluralize nouns and conjugate verbs
            Nouns nouns = new Nouns(plugenv);
            Console.WriteLine("person becomes " + nouns.Pluralize("person"));
            Verbs verbs = new Verbs(plugenv);
            Console.WriteLine("goes becomes " + verbs.ComposePast("goes"));
        }
Exemplo n.º 2
0
        public static string ContentsCode(Context context, POSTagger tagger, GrammarParser parser)
        {
            StringBuilder result = new StringBuilder();
            foreach (IContent content in context.Contents)
            {
                string name = content.Name;

                if (content is Variable)
                {
                    IParsedPhrase phrase = ((Variable)content).Produce(context, tagger, parser);
                    if (phrase != null)
                        name = phrase.Text;
                }

                if (name[0] == ' ')
                    result.Append(name.Substring(1));
                else
                {
                    if (result.Length > 0)
                        result.Append(" ");
                    result.Append(name);
                }
            }

            return result.ToString();
        }
Exemplo n.º 3
0
        public static List<IContent> Produced(Context context, POSTagger tagger, GrammarParser parser)
        {
            List<IContent> result = new List<IContent>();
            foreach (IContent content in context.Contents)
            {
                if (content is Word)
                    result.Add(content);
                else if (content is Special && (content.Name.StartsWith("*") || content.Name.StartsWith("_")))
                {
                    List<IContent> words = GetStarValue(context, content.Name);
                    result.AddRange(words);
                }
                else if (content is Variable)
                {
                    IParsedPhrase phrase = ((Variable)content).Produce(context, tagger, parser);
                    if (phrase == null)
                        return null;    // we failed!  don't use it!

                    List<string> words = GroupPhrase.PhraseToTexts(phrase);
                    foreach (string word in words)
                        result.Add(new Word(word));
                }
                else
                    result.Add(content);
            }

            return result;
        }
 public MatchProduceAgent(ArgumentMode argmode, double salience, int space, int time, POSTagger tagger, GrammarParser parser)
     : base(argmode, salience, space, time)
 {
     this.tagger = tagger;
     this.parser = parser;
     this.breakpointCall = false;
 }
Exemplo n.º 5
0
        public virtual IParsedPhrase ConceptToPhrase(Context context, Concept concept, POSTagger tagger, GrammarParser parser)
        {
            if (concept.IsUnknown)
                return null;

            return concept.ToPhrase(tagger, parser);
        }
 public StringTagHandler(POSTagger tagger)
     : base("Part of Speech String Tag",
         "Tag each element of a string with a part of speech",
         new StringArgumentType(int.MaxValue, ".+", "buffalo buffalo"),
         LanguageNet.Grammarian.POSTagger.TagEnumerationResultType, 120)
 {
     this.tagger = tagger;
 }
 public StringParseHandler(PluginEnvironment plugenv)
     : base("Grammar Parser of Strings",
         "Construct an IParsedPhrase for a given string",
         new StringArgumentType(int.MaxValue, ".+", "buffalo buffalo"),
         GrammarParser.GrammarParseResultType, 120)
 {
     tagger = new POSTagger(plugenv);
 }
 // Describe interface to UnitaryHandler
 public PhraseResolveHandler(POSTagger tagger)
     : base("Phrase List Tag",
         "Resolve the unknown elements contained in a list of Phrases.",
         new EnumerableArgumentType(int.MaxValue, new TypedArgumentType(typeof(IParsedPhrase), new WordPhrase("bufallo", "NN"))),
         LanguageNet.Grammarian.POSTagger.TagEnumerationResultType, 80)
 {
     this.tagger = tagger;
 }
        public static bool PrintContents(Context context, IContinuation succ, IFailure fail, params object[] args)
        {
            PluginEnvironment plugenv = (PluginEnvironment) args[0];
            POSTagger tagger = new POSTagger(plugenv);
            GrammarParser parser = new GrammarParser(plugenv);

            Console.WriteLine(StarUtilities.ProducedCode(context, tagger, parser));
            succ.Continue(new Context(context, new List<IContent>()), fail);
            return true;
        }
        public ConceptRelation(double salience, PluginEnvironment plugenv, string relation, POSTagger tagger, GrammarParser parser)
            : base(ArgumentMode.ManyArguments, salience, 4, 100)
        {
            this.relation = relation;
            this.tagger = tagger;
            this.parser = parser;

            // Look up the datasources for ConceptNet
            principleSource = plugenv.GetDataSource<string, Notion>(ConceptNetUtilities.PrincipleSourceName);
            assertionSource = plugenv.GetDataSource<KeyValuePair<Notion, string>, List<Assertion>>(ConceptNetUtilities.AssertionSourceName);
        }
Exemplo n.º 11
0
        public void TestLongParse()
        {
            PluginEnvironment plugenv = new PluginEnvironment(this);
            plugenv.Initialize("/Users/jrising/projects/virsona/github/config.xml", new NameValueCollection());

            POSTagger tagger = new POSTagger(plugenv);

            string input = @"2. GENERAL POLICIES--IMMEDIATE AND LONG-RANGE

            During the war, production for civilian use was limited by war needs and available manpower. Economic stabilization required measures to spread limited supplies equitably by rationing, price controls, increased taxes, savings bond campaigns, and credit controls. Now, with the surrender of our enemies, economic stabilization requires that policies be directed toward promoting an increase in supplies at low unit prices.
            We must encourage the development of resources and enterprises in all parts of the country, particularly in underdeveloped areas. For example, the establishment of new peacetime industries in the Western States and in the South would, in my judgment, add to existing production and markets rather than merely bring about a shifting of production. I am asking the Secretaries of Agriculture, Commerce, and Labor to explore jointly methods for stimulating new industries, particularly in areas with surplus agricultural labor.
            We must also aid small businessmen and particularly veterans who are competent to start their own businesses. The establishment and development of efficient small business ventures, I believe, will not take away from, but rather will add to, the total business of all enterprises.
            Even with maximum encouragement of production, we cannot hope to remove scarcities within a short time. The most serious deficiencies will persist in the fields of residential housing, building materials, and consumers' durable goods. The critical situation makes continued rent control, price control, and priorities, allocations, and inventory controls absolutely essential. Continued control of consumer credit will help to reduce the pressure on prices of durable goods and will also prolong the period during which the backlog demand will be effective.
            While we are meeting these immediate needs we must look forward to a long-range program of security and increased standard of living.
            The best protection of purchasing power is a policy of full production and full employment opportunities. Obviously, an employed worker is a better customer than an unemployed worker. There always will be, however, some frictional unemployment. In the present period of transition we must deal with such temporary unemployment as results from the fact that demobilization will proceed faster than reconversion or industrial expansion. Such temporary unemployment is probably unavoidable in a period of rapid change. The unemployed worker is a victim of conditions beyond his control. He should be enabled to maintain a reasonable standard of living for himself and his family.
            The most serious difficulty in the path of reconversion and expansion is the establishment of a fair wage structure.
            The ability of labor and management to work together, and the wage and price policies which they develop, are social and economic issues of first importance.
            Both labor and management have a special interest. Labor's interest is very direct and personal because working conditions, wages, and prices affect the very life and happiness of the worker and his family.
            Management has a no less direct interest because on management rests the responsibility for conducting a growing and prosperous business.
            But management and labor have identical interests in the long run. Good wages mean good markets. Good business means more jobs and better wages. In this age of cooperation and in our highly organized economy the problems of one very soon become the problems of all.
            Better human relationships are an urgent need to which organized labor and management should address themselves. No government policy can make men understand each other, agree, and get along unless they conduct themselves in a way to foster mutual respect and good will.
            The Government can, however, help to develop machinery which, with the backing of public opinion, will assist labor and management to resolve their disagreements in a peaceful manner and reduce the number and duration of strikes.
            All of us realize that productivity--increased output per man--is in the long run the basis of our standard of living. Management especially must realize that if labor is to work wholeheartedly for an increase in production, workers must be given a just share of increased output in higher wages.
            Most industries and most companies have adequate leeway within which to grant substantial wage increases. These increases will have a direct effect in increasing consumer demand to the high levels needed. Substantial wage increases are good business for business because they assure a large market for their products; substantial wage increases are good business for labor because they increase labor's standard of living; substantial wage increases are good business for the country as a whole because capacity production means an active, healthy, friendly citizenry enjoying the benefits of democracy under our free enterprise system.
            Labor and management in many industries have been operating successfully under the Government's wage-price policy. Upward revisions of wage scales have been made in thousands of establishments throughout the Nation since VJ-day. It is estimated that about 6 million workers, or more than 20 percent of all employees in nonagricultural and nongovernmental establishments, have received wage increases since August 18, 1945. The amounts of increases given by individual employers concentrate between 10 and 15 percent, but range from less than 5 percent to over 30 percent.
            The United States Conciliation Service since VJ-day has settled over 3,000 disputes affecting over 1,300,000 workers without a strike threat and has assisted in settling about 1,300 disputes where strikes were threatened which involved about 500,000 workers. Only workers directly involved, and not those in related industries who might have been indirectly affected, are included in these estimates.
            Many of these adjustments have occurred in key industries and would have seemed to us major crises if they had not been settled peaceably.
            Within the framework of the wage-price policy there has been definite success, and it is to be expected that this success will continue in a vast majority of the cases arising in the months ahead.
            However, everyone who realizes the extreme need for a swift and orderly reconversion must feel a deep concern about the number of major strikes now in progress. If long continued, these strikes could put a heavy brake on our program.
            I have already made recommendations to the Congress as to the procedure best adapted to meeting the threat of work stoppages in Nation-wide industries without sacrificing the fundamental rights of labor to bargain collectively and ultimately to strike in support of their position.
            If we manage our economy properly, the future will see us on a level of production half again as high as anything we have ever accomplished in peacetime. Business can in the future pay higher wages and sell for lower prices than ever before. This is not true now for all companies, nor will it ever be true for all, but for business generally it is true.
            We are relying on all concerned to develop, through collective bargaining, wage structures that are fair to labor, allow for necessary business incentives, and conform with a policy designed to ""hold the line"" on prices.
            Production and more production was the byword during the war and still is during the transition from war to peace. However, when deferred demand slackens, we shall once again face the deflationary dangers which beset this and other countries during the 1930's. Prosperity can be assured only by a high level of demand supported by high current income; it cannot be sustained by deferred needs and use of accumulated savings.
            If we take the right steps in time we can certainly avoid the disastrous excesses of runaway booms and headlong depressions. We must not let a year or two of prosperity lull us into a false feeling of security and a repetition of the mistakes of the 1920's that culminated in the crash of 1929.
            During the year ahead the Government will be called upon to act in many important fields of economic policy from taxation and foreign trade to social security and housing. In every case there will be alternatives. We must choose the alternatives which will best measure up to our need for maintaining production and employment in the future. We must never lose sight of our long-term objectives: the broadening of markets--the maintenance of steadily rising demand. This demand can come from only three sources: consumers, businesses, or government.
            In this country the job of production and distribution is in the hands of businessmen, farmers, workers, and professional people -- in the hands of our citizens. We want to keep it that way. However, it is the Government's responsibility to help business, labor, and farmers do their jobs.
            There is no question in my mind that the Government, acting on behalf of all the people, must assume the ultimate responsibility for the economic health of the Nation. There is no other agency that can. No other organization has the scope or the authority, nor is any other agency accountable, to all the people. This does not mean that the Government has the sole responsibility, nor that it can do the job alone, nor that it can do the job directly.
            All of the policies of the Federal Government must be geared to the objective of sustained full production and full employment--to raise consumer purchasing power and to encourage business investment. The programs we adopt this year and from now on will determine our ability to achieve our objectives. We must continue to pay particular attention to our fiscal, monetary, and tax policy, programs to aid business--especially small business--and transportation, labor-management relations and wage-price policy, social security and health, education, the farm program, public works, housing and resource development, and economic foreign policy.
            For example, the kinds of tax measures we have at different times--whether we raise our revenue in a way to encourage consumer spending and business investment or to discourage it--have a vital bearing on this question. It is affected also by regular notions on consumer credit and by the money market, which is strongly influenced by the rate of interest on Government securities. It is affected by almost every step we take.
            In short, the way we handle the proper functions of government, the way we time the exercise of our traditional and legitimate governmental functions, has a vital bearing on the economic health of the Nation.
            These policies are discussed in greater detail in the accompanying Fifth Quarterly Report of the Director of War Mobilization and Reconversion.";

            Console.WriteLine(Profiler.AnnounceEach());
            List<KeyValuePair<string, string>> tokens = tagger.TagString(input);
            Sentence sentence = new Sentence(tokens);
            Profiler timer = new Profiler();
            IParsedPhrase parsed = sentence.Parse();
            Console.WriteLine(parsed.ToString());
            Console.WriteLine("Time: " + timer.GetTime());
        }
Exemplo n.º 12
0
        public static IParsedPhrase ProducedPhrase(Context context, POSTagger tagger, GrammarParser parser)
        {
            List<IParsedPhrase> phrases = new List<IParsedPhrase>();
            foreach (IContent content in context.Contents)
            {
                if (content is Word)
                    phrases.Add(new WordPhrase(content.Name));
                else if (content is Special && (content.Name.StartsWith("*") || content.Name.StartsWith("_")))
                {
                    List<IContent> words = GetStarValue(context, content.Name);
                    foreach (IContent word in words)
                        phrases.Add(new WordPhrase(content.Name));
                }
                else if (content is Variable) {
                    IParsedPhrase phrase = ((Variable)content).Produce(context, tagger, parser);
                    if (phrase == null)
                        return null;    // failed!
                    phrases.Add(phrase);
                }
                else if (content is Concept)
                    phrases.Add(new WordPhrase(((Concept)content).Name));
                else
                    phrases.Add(new WordPhrase(content.Name));
            }

            if (phrases.Count == 0)
                return null;

            List<KeyValuePair<string, string>> tokens = tagger.ResolveUnknowns(phrases);
            return parser.Parse(tokens);
        }
 public SentenceSequenceVariable(double salience, POSTagger tagger, GrammarParser parser)
     : base(ArgumentMode.RemainderUnevaluated, salience, 8, 10, tagger, parser)
 {
     //this.breakpointCall = true;
 }
 public SentenceVariable(double salience, POSTagger tagger, GrammarParser parser, IParsedPhrase final)
     : base(ArgumentMode.RemainderUnevaluated, salience, 8, 10, tagger, parser)
 {
     this.tagger = tagger;
     this.final = final;
 }
Exemplo n.º 15
0
        public static string ProducedCode(Context context, POSTagger tagger, GrammarParser parser)
        {
            List<IContent> produced = Produced(context, tagger, parser);
            if (produced == null)
                return null;

            return ContentsCode(new Context(context, produced), tagger, parser);
        }
Exemplo n.º 16
0
        public IParsedPhrase ToPhrase(POSTagger tagger, GrammarParser parser)
        {
            if (name.Contains(" "))
            {
                List<IParsedPhrase> phrases = new List<IParsedPhrase>();
                List<string> words = StringUtilities.SplitWords(name, true);
                foreach (string word in words)
                    phrases.Add(new WordPhrase(word, "??"));

                List<KeyValuePair<string, string>> tokens = tagger.ResolveUnknowns(phrases);

                return parser.Parse(tokens);
            }
            else
            {
                if (kind == Kind.Event)
                    return new WordPhrase(name, "VB");
                if (kind == Kind.Attribute)
                    return new WordPhrase(name, "JJ");
                // entity
                return new WordPhrase(name, "NN");
            }
        }
 public ClauseVariable(double salience, POSTagger tagger, GrammarParser parser)
     : base(ArgumentMode.RemainderUnevaluated, salience, 0, 10, tagger, parser)
 {
 }
 public ProgressiveVariableAgent(string name, double salience, POSTagger tagger, GrammarParser parser)
     : base(ArgumentMode.NoArugments, salience, 10, 10, tagger, parser)
 {
     this.name = name;
 }
        public static void LoadVariables(Context context, double salience, Memory memory, ConceptTranslator produceTranslator, Verbs verbs, Nouns nouns, PluginEnvironment plugenv)
        {
            POSTagger tagger = new POSTagger(plugenv);
            GrammarParser parser = new GrammarParser(plugenv);

            context.Map.Add("@know", new KnowRule(salience, memory, tagger, parser));
            context.Map.Add("@event", new EventRule(salience, memory, tagger, parser));

            context.Map.Add("@Subject", new SimpleDatumRule(salience, Relations.Relation.Subject, memory, produceTranslator, tagger, parser));
            context.Map.Add("@Object", new SimpleDatumRule(salience, Relations.Relation.Object, memory, produceTranslator, tagger, parser));
            context.Map.Add("@Indirect", new SimpleDatumRule(salience, Relations.Relation.Indirect, memory, produceTranslator, tagger, parser));
            context.Map.Add("@IsA", new SimpleDatumRule(salience, Relations.Relation.IsA, memory, produceTranslator, tagger, parser));
            context.Map.Add("@HasProperty", new SimpleDatumRule(salience, Relations.Relation.HasProperty, memory, produceTranslator, tagger, parser));
            context.Map.Add("@Means", new SimpleDatumRule(salience, Relations.Relation.Means, memory, produceTranslator, tagger, parser));
            context.Map.Add("@Condition", new SimpleDatumRule(salience, Relations.Relation.Condition, memory, produceTranslator, tagger, parser));
            context.Map.Add("@MotivatedBy", new SimpleDatumRule(salience, Relations.Relation.MotivatedByGoal, memory, produceTranslator, tagger, parser));
            context.Map.Add("@Exists", new SimpleDatumRule(salience, Relations.Relation.Exists, memory, produceTranslator, tagger, parser));
            context.Map.Add("@UsedFor", new SimpleDatumRule(salience, Relations.Relation.UsedFor, memory, produceTranslator, tagger, parser));
            context.Map.Add("@AtTime", new AtTimeRule(salience, memory, tagger, parser));
            context.Map.Add("@InLocation", new InLocationRule(salience, memory, verbs, tagger, parser));

            //context.Map.Add("@ActiveObjects", new AllObjectsRule(salience, true, memory, produceTranslator, tagger, parser));
            //context.Map.Add("@PassiveObjects", new AllObjectsRule(salience, false, memory, produceTranslator, tagger, parser));

            context.Map.Add("@EntityPrep", new EntityPrepRule(salience, memory, verbs, tagger, parser));
            context.Map.Add("@SubjectTense", new TenseRule(salience, Relations.Relation.Subject, memory, verbs, nouns, tagger, parser));

            context.Map.Add("%unknown", new UnknownConceptVariable("%unknown", null));
            context.Map.Add("%unevent", new UnknownConceptVariable("%unevent", Concept.Kind.Event));
            context.Map.Add("%unthing", new UnknownConceptVariable("%unthing", Concept.Kind.Entity));
            context.Map.Add("%unquality", new UnknownConceptVariable("%unquality", Concept.Kind.Attribute));
        }
 public EventRule(double salience, Memory memory, POSTagger tagger, GrammarParser parser)
     : base(salience, memory, tagger, parser)
 {
 }
Exemplo n.º 21
0
        public virtual IParsedPhrase Produce(Context env, POSTagger tagger, GrammarParser parser)
        {
            object var = env.LookupDefaulted<object>("$p$" + name, null);
            if (var is ThreeTuple<GetValue, object, object[]>)
            {
                ThreeTuple<GetValue, object, object[]> tuple = (ThreeTuple<GetValue, object, object[]>)var;
                var = tuple.one(tuple.two, tuple.three);
            }

            if (var is IParsedPhrase)
                return (IParsedPhrase)var;
            else if (var is Concept)
                return ConceptToPhrase(env, (Concept)var, tagger, parser);

            return null;    // don't produce anything!
        }
        public override IParsedPhrase ConceptToPhrase(Context context, Concept concept, POSTagger tagger, GrammarParser parser)
        {
            Verbs.Person person = Verbs.Person.ThirdSingle;

            object start = context.LookupDefaulted<object>("$check", null);
            if (start != null && start is Datum) {
                Datum noundat = KnowledgeUtilities.GetClosestDatum(memory, (Datum) start, Relations.Relation.Subject);
                person = nouns.GetPerson(noundat.Right.Name);
            }

            return Relations.ConjugateToPhrase(memory, conjugate, person, concept);
        }
Exemplo n.º 23
0
        public void Initialize(string config)
        {
            plugenv = new PluginEnvironment(this);
            if (!File.Exists(config)) {
                Console.WriteLine("Cannot find configuration file at " + config);
                return;
            }

            plugenv.Initialize(config, new NameValueCollection());

            tagger = new POSTagger(plugenv);
            parser = new GrammarParser(plugenv);

            coderack = new ZippyCoderack(this, 10000000);
            memory = new Memory();

            basectx = new Context(coderack);
            GrammarVariables.LoadVariables(basectx, 100.0, memory, plugenv);
            OutputVariables.LoadVariables(basectx, 100.0, plugenv);
            ProgramVariables.LoadVariables(basectx, 100.0, plugenv);
            basectx.Map.Add("$Compare", new WordComparer());

            initialized = true;
        }
 public KnowRule(double salience, Memory memory, POSTagger tagger, GrammarParser parser)
     : base(ArgumentMode.ManyArguments, salience, 2 * 4, 3, tagger, parser)
 {
     this.memory = memory;
     this.tagger = tagger;
 }
 public PhraseVariable(double salience, Variable variable, POSTagger tagger, GrammarParser parser)
     : base(ArgumentMode.RemainderUnevaluated, salience, 4, 10, tagger, parser)
 {
     this.variable = variable;
 }
 public static void LoadVariables(Context context, PluginEnvironment plugenv, double basesal, POSTagger tagger)
 {
     GrammarParser parser = new GrammarParser(plugenv);
     context.Map.Add("%AtLocation", new ConceptRelation(basesal, plugenv, "AtLocation", tagger, parser));
     context.Map.Add("%DefinedAs", new ConceptRelation(basesal, plugenv, "DefinedAs", tagger, parser));
 }
 public SimpleDatumRule(double salience, Relations.Relation kind, Memory memory, ConceptTranslator produceTranslator, POSTagger tagger, GrammarParser parser)
     : base(ArgumentMode.ManyArguments, salience, 3 * 4, 10, tagger, parser)
 {
     this.kind = kind;
     this.memory = memory;
     this.produceTranslator = produceTranslator;
     this.tagger = tagger;
 }
 public InLocationRule(double salience, Memory memory, Verbs verbs, POSTagger tagger, GrammarParser parser)
     : base(ArgumentMode.ManyArguments, salience, 3 * 4, 10, tagger, parser)
 {
     this.memory = memory;
     this.verbs = verbs;
     this.tagger = tagger;
 }
        public TenseRule(double salience, Relations.Relation nounrel, Memory memory, Verbs verbs, Nouns nouns, POSTagger tagger, GrammarParser parser)
            : base(ArgumentMode.ManyArguments, salience, 2 * 4, 10, tagger, parser)
        {
            this.nounrel = nounrel;

            this.memory = memory;
            this.verbs = verbs;
            this.nouns = nouns;
        }
        public static void LoadVariables(Context context, double salience, Memory memory, PluginEnvironment plugenv)
        {
            Verbs verbs = new Verbs(plugenv);
            POSTagger tagger = new POSTagger(plugenv);
            GrammarParser parser = new GrammarParser(plugenv);

            context.Map.Add("%is", new IrregularVerbVariable("%is", memory, Verbs.IsToBe, Verbs.ComposeToBe));
            context.Map.Add("%has", new IrregularVerbVariable("%has", memory, Verbs.IsToHave, Verbs.ComposeToHave));
            context.Map.Add("%do", new IrregularVerbVariable("%do", memory, Verbs.IsToDo, Verbs.ComposeToDo));

            context.Map.Add("%noun", new NounVariable());
            context.Map.Add("%pronoun", new PartListVariable("%pronoun", new string[] {"PRP", "WP"}));
            context.Map.Add("%adj", new PartListVariable("%adj", new string[] {"JJ", "JP"}));
            context.Map.Add("%adv", new PartListVariable("%adv", new string[] {"RB", "ADVP"}));
            context.Map.Add("%verb", new VerbVariable(verbs));
            context.Map.Add("%verbx", new VerbSubVariable("%verbx", verbs, "VBP", Verbs.Convert.ext_V));
            context.Map.Add("%verben", new VerbSubVariable("%verben", verbs, "VBN", Verbs.Convert.ext_Ven));
            context.Map.Add("%verbing", new VerbSubVariable("%verbing", verbs, "VBG", Verbs.Convert.ext_Ving));
            context.Map.Add("%verbed", new VerbSubVariable("%verbed", verbs, "VBD", Verbs.Convert.ext_Ved));
            context.Map.Add("%verbs", new VerbSubVariable("%verbs", verbs, "VBZ", Verbs.Convert.ext_Vs));
            context.Map.Add("%verball", new VerbSubVariable("%verball", verbs, "VP", Verbs.Convert.ext_V));
            context.Map.Add("%will", new ModalVariable());
            context.Map.Add("%event", new EventVariable());
            context.Map.Add("%punct", new PunctuationVariable());
            context.Map.Add("%inall", new PrepositionalPhraseVariable());
            context.Map.Add("%attime", new AtTimeVariable());

            context.Map.Add("%sentence", new SentenceVariable(salience, tagger, parser, new WordPhrase(" .", ".")));   // matches any sentence in the input
            context.Map.Add("%question", new SentenceVariable(salience, tagger, parser, new WordPhrase(" ?", "?")));
            context.Map.Add("%phrase", new PhraseVariable(salience, null, tagger, parser));
            context.Map.Add("%nounphrase", new PhraseVariable(salience, new NounVariable(), tagger, parser));
            context.Map.Add("%paren", new ParentheticalVariable(salience, tagger, parser));
            context.Map.Add("%clause", new ClauseVariable(salience, tagger, parser));  // Like %sentence ... %opt .
            //context.Map.Add("%xconj", new ConjugationVariable(coderack, salience, null));
            context.Map.Add("%sentences", new SentenceSequenceVariable(salience, tagger, parser));

            context.Map.Add("%opt", new Special("%opt"));

            context.Map.Add(":lower", new LowercaseDeclination());
            context.Map.Add(":capital", new CapitalizeDeclination());
            context.Map.Add(":x", new VerbSubDeclination(verbs, "VBP", Verbs.Convert.ext_V));
            context.Map.Add(":en", new VerbSubDeclination(verbs, "VBN", Verbs.Convert.ext_Ven));
            context.Map.Add(":ing", new VerbSubDeclination(verbs, "VBG", Verbs.Convert.ext_Ving));
            context.Map.Add(":ed", new VerbSubDeclination(verbs, "VBD", Verbs.Convert.ext_Vs));
            context.Map.Add(":s", new VerbSubDeclination(verbs, "VBZ", Verbs.Convert.ext_V));
        }