コード例 #1
0
        /*public void checkExistenceOfFiles()
         * {
         *  if (this.Options.RegexFileName !="" && !File.Exists(this.Options.RegexFileName) ||
         *      this.Options.TMFileName != "" && !File.Exists(this.Options.TMFileName) ||
         *      this.Options.GlossaryFileName != "" && !File.Exists(this.Options.GlossaryFileName))
         *  {
         *      MessageBox.Show("TermInjector settings refer to files that do not exist. Check that the glossary files (if defined) and the TM have correct paths.");
         *      TermInjectorTranslationProviderConfDialog dialog = new TermInjectorTranslationProviderConfDialog(this.Options, this);
         *      if (dialog.ShowDialog() == DialogResult.OK)
         *      {
         *          this.Options = dialog.Options;
         *      }
         *      if (dialog.ShowDialog() == DialogResult.Cancel)
         *      {
         *          throw new Exception();
         *      }
         *  }
         *
         * }
         */


        public TermInjectorTranslationProvider(TermInjectorTranslationOptions options)
        {
            this.Options = options;

            //Initialize regex building objects
            this.regexTrieFactory = new RegexTrieFactory <TranslationAndReplacement>();

            this.determiniser = new Determiniser <TranslationAndReplacement>();
            this.trieLoader   = new TrieLoader(regexTrieFactory, determiniser);

            //Check that the files specified in the options exist
            //this.checkExistenceOfFiles();

            //Load tries and TM
            try
            {
                this.loadTries();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.loadTM();

            //Initialize the segment visitors
            this.initializeVisitors();
        }
コード例 #2
0
 public TrieLoader(RegexTrieFactory <TranslationAndReplacement> regexTrieFactory, Determiniser <TranslationAndReplacement> determiniser)
 {
     this.regexTrieFactory = regexTrieFactory;
     this.determiniser     = determiniser;
     this.validationErrors = new List <KeyValuePair <string, string> >();
 }