private MorphemeContainer <Root> ParseRoots(string dataTxt) { try { var rootsBySurface = new MorphemeSurfaceDictionary <Root>(); var rootsById = new Dictionary <string, Root>(); var reader = new RootLexiconReader(_orthography); using (var stream = GenerateStreamFromString(dataTxt)) { var ds = TextToDataSet.Convert(stream, DefaultTableName, Delimiter); reader.AddEntries(ds, DefaultTableName, rootsById, rootsBySurface); } return(new MorphemeContainer <Root>(rootsById, rootsBySurface)); } catch (Exception ex) { throw new InvalidLanguageFileException(ex, Type.Roots, "Invalid language file for roots: " + _languageType); } }
private MorphemeSurfaceDictionary <Root> ReadRoots() { try { var roots = new MorphemeSurfaceDictionary <Root>(); var reader = new RootLexiconReader(_orthography); string rootsPath = _dirPath + _seperator + Resources.InternalMainRootsPath; if (_external) { using (var stream = new FileStream(rootsPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { reader.AddEntries(TextToDataSet.Convert(stream, DefaultTableName, Delimiter), DefaultTableName, roots); } return(roots); } reader.AddEntries(EmbeddedTextResourceToDataSet(rootsPath), DefaultTableName, roots); string namesPath = _dirPath + _seperator + Resources.InternalPersonNamesPath; reader.AddEntries(EmbeddedTextResourceToDataSet(namesPath), DefaultTableName, roots); string abbreviationPath = _dirPath + _seperator + Resources.InternalAbbreviationsPath; reader.AddEntries(EmbeddedTextResourceToDataSet(abbreviationPath), DefaultTableName, roots); return(roots); } catch (Exception ex) { throw new InvalidLanguageFileException(ex, Type.Roots, "Invalid language file for roots: "); } }
private MorphemeSurfaceDictionary<Root> ReadRoots() { try { var roots = new MorphemeSurfaceDictionary<Root>(); var reader = new RootLexiconReader(_orthography); string rootsPath = _dirPath + _seperator + Resources.InternalMainRootsPath; if (_external) { using (var stream = new FileStream(rootsPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { reader.AddEntries(TextToDataSet.Convert(stream, DefaultTableName, Delimiter), DefaultTableName, roots); } return roots; } reader.AddEntries(EmbeddedTextResourceToDataSet(rootsPath), DefaultTableName, roots); string namesPath = _dirPath + _seperator + Resources.InternalPersonNamesPath; reader.AddEntries(EmbeddedTextResourceToDataSet(namesPath), DefaultTableName, roots); string abbreviationPath = _dirPath + _seperator + Resources.InternalAbbreviationsPath; reader.AddEntries(EmbeddedTextResourceToDataSet(abbreviationPath), DefaultTableName, roots); return roots; } catch (Exception ex) { throw new InvalidLanguageFileException(ex, Type.Roots, "Invalid language file for roots: "); } }
private MorphemeContainer<Root> ParseRoots(string dataTxt) { try { var rootsBySurface = new MorphemeSurfaceDictionary<Root>(); var rootsById = new Dictionary<string, Root>(); var reader = new RootLexiconReader(_orthography); using (var stream = GenerateStreamFromString(dataTxt)) { var ds = TextToDataSet.Convert(stream, DefaultTableName, Delimiter); reader.AddEntries(ds, DefaultTableName, rootsById, rootsBySurface); } return new MorphemeContainer<Root>(rootsById, rootsBySurface); } catch (Exception ex) { throw new InvalidLanguageFileException(ex, Type.Roots, "Invalid language file for roots: "); } }