Beispiel #1
0
        public void DeletionsMatrixTest()
        {
            DeletionsMatrixGenerator generator = new DeletionsMatrixGenerator(alphabetWithSpace);
            var matrix = generator.GenerateMatrix(this.testData);

            Assert.AreEqual(1, matrix['c']['t']);

            // other random field
            Assert.AreEqual(0, matrix['d']['t']);
        }
Beispiel #2
0
        public DictionaryGenerator(Dictionary dictionary, string directory, string outputDirectory)
        {
            this.dictionary = dictionary;
            this.outputDirectory = outputDirectory;
            this.directory = directory;
            this.errorModel = new MPSpell.Correction.ErrorModel(dictionary);
            this.languageModel = new LanguageModel(dictionary);

            int initValue = 1;

            char[] alphabetWithSpace = dictionary.GetAlphabetForErrorModel(true).ToCharArray();
            char[] alphabet = dictionary.GetAlphabetForErrorModel().ToCharArray();
            insGen = new InsertionsMatrixGenerator(alphabetWithSpace, initValue);
            delGen = new DeletionsMatrixGenerator(alphabetWithSpace, initValue);
            subGen = new SubstitutionsMatrixGenerator(alphabet, initValue);
            trnGen = new TranspositionsMatrixGenerator(alphabet, initValue);

            charCounter = new CharFrequencyCounter(alphabetWithSpace.ToStringArray());
            twoCharCounter = new TwoCharFrequencyCounter(alphabetWithSpace.ToStringArray());
        }