public void InsertionsMatrixTest() { InsertionsMatrixGenerator generator = new InsertionsMatrixGenerator(alphabetWithSpace); var matrix = generator.GenerateMatrix(this.testData); Assert.AreEqual(1, matrix[' ']['a']); Assert.AreEqual(1, matrix['e']['s']); Assert.AreEqual(1, matrix['s']['s']); // other random field Assert.AreEqual(0, matrix['c']['d']); }
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()); }