예제 #1
0
        public IdentifierSplitResult(string identifier, IndexerFile indexerFile)
        {
            Identifier  = identifier;
            IndexerFile = indexerFile;

            _splits = new List <SplitWithIdentification>();
        }
예제 #2
0
        /// <summary>
        /// Adds items to respecitive category and associates it with indexer file too
        /// </summary>
        /// <param name="splitWithIdentification">Split information</param>
        /// <param name="file">File the split belongs to</param>
        private void AddIdentificationToList(SplitWithIdentification splitWithIdentification, IndexerFile file)
        {
            string splitToAdd = splitWithIdentification.Split.ToLower();

            switch (splitWithIdentification.SplitIdentification)
            {
            case SplitIdentification.Identified:
                if (_dictionaryWordList.ContainsKey(splitToAdd))
                {
                    if (!_dictionaryWordList[splitToAdd].Contains(file))
                    {
                        _dictionaryWordList[splitToAdd].Add(file);
                    }
                }
                else
                {
                    _dictionaryWordList.Add(splitToAdd, new List <IndexerFile>()
                    {
                        file
                    });
                }
                break;

            case SplitIdentification.Token:
            case SplitIdentification.SingleLetterIdentifier:
                if (_tokenList.ContainsKey(splitToAdd))
                {
                    if (!_tokenList[splitToAdd].Contains(file))
                    {
                        _tokenList[splitToAdd].Add(file);
                    }
                }
                else
                {
                    _tokenList.Add(splitToAdd, new List <IndexerFile>()
                    {
                        file
                    });
                }
                break;

            case SplitIdentification.Unidentified:
                if (_unidentifiedList.ContainsKey(splitToAdd))
                {
                    if (!_unidentifiedList[splitToAdd].Contains(file))
                    {
                        _unidentifiedList[splitToAdd].Add(file);
                    }
                }
                else
                {
                    _unidentifiedList.Add(splitToAdd, new List <IndexerFile>()
                    {
                        file
                    });
                }
                break;

            case SplitIdentification.MergedToken:
                if (_mergedTokenList.ContainsKey(splitToAdd))
                {
                    if (!_mergedTokenList[splitToAdd].Contains(file))
                    {
                        _mergedTokenList[splitToAdd].Add(file);
                    }
                }
                else
                {
                    _mergedTokenList.Add(splitToAdd, new List <IndexerFile>()
                    {
                        file
                    });
                }
                break;

            case SplitIdentification.WordMisspelled:
            case SplitIdentification.TokenMisspelled:
                if (!_correctedDictionary.ContainsKey(splitToAdd))
                {
                    _correctedDictionary.Add(splitToAdd, new WordWithFiles(null, new List <IndexerFile>()
                    {
                        file
                    }));
                }
                else
                {
                    if (!_correctedDictionary[splitToAdd].IndexerFiles.Contains(file))
                    {
                        _correctedDictionary[splitToAdd].IndexerFiles.Add(file);
                    }
                }
                break;

            case SplitIdentification.TokenStemmed:
            case SplitIdentification.WordStemmed:
                if (!_stemmedDictionary.ContainsKey(splitToAdd))
                {
                    _stemmedDictionary.Add(splitToAdd, new WordWithFiles(null, new List <IndexerFile>()
                    {
                        file
                    }));
                }
                else
                {
                    if (!_stemmedDictionary[splitToAdd].IndexerFiles.Contains(file))
                    {
                        _stemmedDictionary[splitToAdd].IndexerFiles.Add(file);
                    }
                }
                break;

            default:
                throw new NotImplementedException("SplitIdentification of type " + splitWithIdentification.SplitIdentification + " is not implemented");
            }
        }