Esempio n. 1
0
        private IEnumerable <int> GetWords(
            ZipArchiveHelper zipArchiveHelper,
            ZipArchiveEntry zipArchiveEntry,
            IDictionary <string, int> wordToId)
        {
            List <int> ids = new List <int>();

            if (zipArchiveEntry != null)
            {
                var text  = zipArchiveHelper.ReadAllTextFromEntry(zipArchiveEntry);
                var words = text.Split(' ', StringSplitOptions.RemoveEmptyEntries);

                foreach (var word in words)
                {
                    if (!wordToId.Keys.Contains(word))
                    {
                        wordToId.Add(word, wordToId.Count);
                    }

                    ids.Add(wordToId[word]);
                }
            }

            return(ids);
        }
Esempio n. 2
0
        private IEnumerable <string> GetLinks(
            ZipArchiveHelper zipArchiveHelper,
            ZipArchiveEntry zipArchiveEntry)
        {
            if (zipArchiveEntry == null)
            {
                return(new string[0]);
            }

            var text = zipArchiveHelper.ReadAllTextFromEntry(zipArchiveEntry);

            if (text.Contains(Environment.NewLine))
            {
                Console.WriteLine("");
            }

            return(text.Split('\n', StringSplitOptions.RemoveEmptyEntries));
        }