Hello,
I'm trying to create a user dictionary with specific word and with English as base language, but I only get an (nearly) empty dictionary file:
My code is:
private FREngine.TextLanguage fillLangDatabase() {
string dictionaryFileName = "D:\\Sample.amd";
string sName = "UserTL";
// Create a LanguageDatabase object
FREngine.LanguageDatabase languageDatabase = engineLoader.Engine.CreateLanguageDatabase();
FREngine.TextLanguage textLanguage = languageDatabase.CreateTextLanguage();
// Copy all attributes from the predefined English language
FREngine.TextLanguage englishLanguage = engineLoader.Engine.PredefinedLanguages.Find("English").TextLanguage;
textLanguage.CopyFrom(englishLanguage);
textLanguage.InternalName = "SampleTL";
// Bind new dictionary to the first (and only) BaseLanguage object within TextLanguage
FREngine.BaseLanguage baseLanguage = textLanguage.BaseLanguages[0];
baseLanguage.InternalName = "SampleBL";
// Create new dictionary
string dictionaryFilePath = dictionaryFileName;
FREngine.Dictionary dictionary = languageDatabase.CreateNewDictionary(dictionaryFilePath, FREngine.LanguageIdEnum.LI_EnglishUnitedStates);
dictionary.Name = "Sample";
// Add words with space to the dictionary
dictionary.AddWord("45N2", 100);
...
...
// Get the collection of dictionary descriptions and remove all items
FREngine.DictionaryDescriptions dictionaryDescriptions = baseLanguage.DictionaryDescriptions;
//dictionaryDescriptions.DeleteAll();
FREngine.IDictionaryDescription dic = dictionaryDescriptions.AddNew(FREngine.DictionaryTypeEnum.DT_UserDictionary);
FREngine.UserDictionaryDescription userDic = dic.GetAsUserDictionaryDescription();
userDic.FileName = dictionaryFilePath;
return textLanguage;
}
Comments
1 comment
Are you sure the dictionary is empty? The hex code doesn't say much, does it?
You can check by loading the Dictionary.
Please sign in to leave a comment.