Exemplo n.º 1
0
        private Suffixes ReadSuffixes()
        {
            try
            {
                Dictionary <string, Suffix>        suffixesById;
                MorphemeSurfaceDictionary <Suffix> suffixesBySurface;

                string path   = _dirPath + _seperator + Resources.InternalSuffixesPath;
                var    reader = new SuffixLexiconReader(_orthography);

                if (_external)
                {
                    using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        reader.Read(TextToDataSet.Convert(stream, DefaultTableName, Delimiter), DefaultTableName,
                                    out suffixesById, out suffixesBySurface);
                    }

                    return(new Suffixes(suffixesById, suffixesBySurface));
                }

                DataSet dataSet = EmbeddedTextResourceToDataSet(path);

                reader.Read(dataSet, DefaultTableName, out suffixesById, out suffixesBySurface);

                return(new Suffixes(suffixesById, suffixesBySurface));
            }
            catch (Exception ex)
            {
                throw new InvalidLanguageFileException(ex, Type.Suffixes, "Invalid language file for suffixes: ");
            }
        }
Exemplo n.º 2
0
        private MorphemeContainer <Suffix> ParseSuffixes(string dataTxt)
        {
            try
            {
                var reader = new SuffixLexiconReader(_orthography);

                using (var stream = GenerateStreamFromString(dataTxt))
                {
                    return(reader.Read(TextToDataSet.Convert(stream, DefaultTableName, Delimiter), DefaultTableName));
                }
            }
            catch (Exception ex)
            {
                throw new InvalidLanguageFileException(ex, Type.Suffixes, "Invalid language file for suffixes: ");
            }
        }
Exemplo n.º 3
0
        private MorphemeContainer <Suffix> ReadSuffixes()
        {
            try
            {
                var path   = _dirPath + _seperator + Resources.InternalSuffixesPath;
                var reader = new SuffixLexiconReader(_orthography);

                if (_external)
                {
                    using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        return(reader.Read(TextToDataSet.Convert(stream, DefaultTableName, Delimiter), DefaultTableName));
                    }
                }

                var dataSet = EmbeddedTextResourceToDataSet(path);

                return(reader.Read(dataSet, DefaultTableName));
            }
            catch (Exception ex)
            {
                throw new InvalidLanguageFileException(ex, Type.Suffixes, "Invalid language file for suffixes: ");
            }
        }
Exemplo n.º 4
0
        private Suffixes ReadSuffixes()
        {
            try
            {
                Dictionary<string, Suffix> suffixesById;
                MorphemeSurfaceDictionary<Suffix> suffixesBySurface;

                string path = _dirPath + _seperator + Resources.InternalSuffixesPath;
                var reader = new SuffixLexiconReader(_orthography);

                if (_external)
                {
                    using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        reader.Read(TextToDataSet.Convert(stream, DefaultTableName, Delimiter), DefaultTableName,
                            out suffixesById, out suffixesBySurface);
                    }

                    return new Suffixes(suffixesById, suffixesBySurface);
                }

                DataSet dataSet = EmbeddedTextResourceToDataSet(path);

                reader.Read(dataSet, DefaultTableName, out suffixesById, out suffixesBySurface);

                return new Suffixes(suffixesById, suffixesBySurface);
            }
            catch (Exception ex)
            {
                throw new InvalidLanguageFileException(ex, Type.Suffixes, "Invalid language file for suffixes: ");
            }
        }
Exemplo n.º 5
0
        private MorphemeContainer<Suffix> ReadSuffixes()
        {
            try
            {
                var path = _dirPath + _seperator + Resources.InternalSuffixesPath;
                var reader = new SuffixLexiconReader(_orthography);

                if (_external)
                {
                    using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        return reader.Read(TextToDataSet.Convert(stream, DefaultTableName, Delimiter), DefaultTableName);
                    }
                }

                var dataSet = EmbeddedTextResourceToDataSet(path);

                return reader.Read(dataSet, DefaultTableName);
            }
            catch (Exception ex)
            {
                throw new InvalidLanguageFileException(ex, Type.Suffixes, "Invalid language file for suffixes: ");
            }
        }
Exemplo n.º 6
0
        private MorphemeContainer<Suffix> ParseSuffixes(string dataTxt)
        {
            try
            {
                var reader = new SuffixLexiconReader(_orthography);

                using (var stream = GenerateStreamFromString(dataTxt))
                {
                    return reader.Read(TextToDataSet.Convert(stream, DefaultTableName, Delimiter), DefaultTableName);
                }
            }
            catch (Exception ex)
            {
                throw new InvalidLanguageFileException(ex, Type.Suffixes, "Invalid language file for suffixes: ");
            }
        }