Beispiel #1
0
        public void InitializeVerbs(PluginEnvironment env, string basedir)
        {
            VerbsData        verbsData  = new VerbsData(basedir);
            ConjugateHandler conjugator = new ConjugateHandler(verbsData);

            env.AddAction(conjugator);
            env.AddAction(new TransitiveTestHandler(verbsData, conjugator));
            env.AddAction(new InflectionTestHandler(verbsData, conjugator));

            char[] tokenizer = new char[] { '\n' };
            int    key_len   = 256;

            IDataSource <string, Verbs.VerbType> transitiveSource      = new AlphabeticFileSet <Verbs.VerbType>(basedir + "verb_transitive.txt", tokenizer, key_len, Verbs.VerbType.VT);
            IDataSource <string, Verbs.VerbType> intransitiveSource    = new AlphabeticFileSet <Verbs.VerbType>(basedir + "verb_intransitive.txt", tokenizer, key_len, Verbs.VerbType.VI);
            IDataSource <string, Verbs.VerbType> eitherSource          = new AlphabeticFileSet <Verbs.VerbType>(basedir + "verb_either.txt", tokenizer, key_len, Verbs.VerbType.VE);
            IDataSource <string, Verbs.VerbType> advTransitiveSource   = new AlphabeticFileSet <Verbs.VerbType>(basedir + "verb_adv_transitive.txt", tokenizer, key_len, Verbs.VerbType.VT);
            IDataSource <string, Verbs.VerbType> advIntransitiveSource = new AlphabeticFileSet <Verbs.VerbType>(basedir + "verb_adv_intransitive.txt", tokenizer, key_len, Verbs.VerbType.VI);
            IDataSource <string, Verbs.VerbType> advEitherSource       = new AlphabeticFileSet <Verbs.VerbType>(basedir + "verb_adv_either.txt", tokenizer, key_len, Verbs.VerbType.VE);
            IDataSource <string, Verbs.VerbType> advPrepSource         = new AlphabeticFileSet <Verbs.VerbType>(basedir + "verb_adv_prep.txt", tokenizer, key_len, Verbs.VerbType.VT);

            env.SetDataSource <string, Verbs.VerbType>(Verbs.VerbTypeSourceName, new ComboSource <string, Verbs.VerbType>(new ComboSource <string, Verbs.VerbType>(
                                                                                                                              new ComboSource <string, Verbs.VerbType>(transitiveSource, intransitiveSource),
                                                                                                                              new ComboSource <string, Verbs.VerbType>(eitherSource, advTransitiveSource)),
                                                                                                                          new ComboSource <string, Verbs.VerbType>(
                                                                                                                              new ComboSource <string, Verbs.VerbType>(advIntransitiveSource, advEitherSource), advPrepSource)));
        }
 public TransitiveTestHandler(VerbsData verbsData, ConjugateHandler conjugator)
     : base("Transitivity Tester",
            "Check if a verb is transitive",
            Verbs.TransitiveArgumentType, Verbs.TransitiveResultType, 120)
 {
     this.verbsData  = verbsData;
     this.conjugator = conjugator;
 }
        public TransitiveTestHandler(VerbsData verbsData, ConjugateHandler conjugator)
            : base("Transitivity Tester",
			       "Check if a verb is transitive",
			       Verbs.TransitiveArgumentType, Verbs.TransitiveResultType, 120)
        {
            this.verbsData = verbsData;
            this.conjugator = conjugator;
        }
        public InflectionTestHandler(VerbsData verbsData, ConjugateHandler conjugator)
            : base("Inflection Tester",
			       "Determine the inflection of a verb",
			       new StringArgumentType(int.MaxValue, ".+", "buffalo"),
			       Verbs.InflectionResultType, 120)
        {
            this.verbsData = verbsData;
            this.conjugator = conjugator;
        }
Beispiel #5
0
 public InflectionTestHandler(VerbsData verbsData, ConjugateHandler conjugator)
     : base("Inflection Tester",
            "Determine the inflection of a verb",
            new StringArgumentType(int.MaxValue, ".+", "buffalo"),
            Verbs.InflectionResultType, 120)
 {
     this.verbsData  = verbsData;
     this.conjugator = conjugator;
 }
        public void InitializeVerbs(PluginEnvironment env, string basedir)
        {
            VerbsData verbsData = new VerbsData(basedir);
            ConjugateHandler conjugator = new ConjugateHandler(verbsData);

            env.AddAction(conjugator);
            env.AddAction(new TransitiveTestHandler(verbsData, conjugator));
            env.AddAction(new InflectionTestHandler(verbsData, conjugator));

            char[] tokenizer = new char[] { '\n' };
            int key_len = 256;

            IDataSource<string, Verbs.VerbType> transitiveSource = new AlphabeticFileSet<Verbs.VerbType>(basedir + "verb_transitive.txt", tokenizer, key_len, Verbs.VerbType.VT);
            IDataSource<string, Verbs.VerbType> intransitiveSource = new AlphabeticFileSet<Verbs.VerbType>(basedir + "verb_intransitive.txt", tokenizer, key_len, Verbs.VerbType.VI);
            IDataSource<string, Verbs.VerbType> eitherSource = new AlphabeticFileSet<Verbs.VerbType>(basedir + "verb_either.txt", tokenizer, key_len, Verbs.VerbType.VE);
            IDataSource<string, Verbs.VerbType> advTransitiveSource = new AlphabeticFileSet<Verbs.VerbType>(basedir + "verb_adv_transitive.txt", tokenizer, key_len, Verbs.VerbType.VT);
            IDataSource<string, Verbs.VerbType> advIntransitiveSource = new AlphabeticFileSet<Verbs.VerbType>(basedir + "verb_adv_intransitive.txt", tokenizer, key_len, Verbs.VerbType.VI);
            IDataSource<string, Verbs.VerbType> advEitherSource = new AlphabeticFileSet<Verbs.VerbType>(basedir + "verb_adv_either.txt", tokenizer, key_len, Verbs.VerbType.VE);
            IDataSource<string, Verbs.VerbType> advPrepSource = new AlphabeticFileSet<Verbs.VerbType>(basedir + "verb_adv_prep.txt", tokenizer, key_len, Verbs.VerbType.VT);

            env.SetDataSource<string, Verbs.VerbType>(Verbs.VerbTypeSourceName, new ComboSource<string, Verbs.VerbType>(new ComboSource<string, Verbs.VerbType>(
                                                      new ComboSource<string, Verbs.VerbType>(transitiveSource, intransitiveSource),
                                                      new ComboSource<string, Verbs.VerbType>(eitherSource, advTransitiveSource)),
                                                                                                                        new ComboSource<string, Verbs.VerbType>(
                                                      new ComboSource<string, Verbs.VerbType>(advIntransitiveSource, advEitherSource), advPrepSource)));
        }