Exemplo n.º 1
0
 private void AddRecord(string alias, AliasKeyword ak)
 {
     if (!aliasDict.ContainsKey(alias.ToLower()))
     {
         aliasDict.Add(alias.ToLower(), ak);
     }
 }
Exemplo n.º 2
0
        private void TryAddRecord(string alias, AliasKeyword trv)
        {
            if (aliasBlackList.Contains(alias.ToLower()) || keyBlackList.Contains(trv.Key.ToLower()))
            {
                return;
            }

            if (!keyList.Contains(trv.Key.ToLower()))
            {
                return;
            }

            this.AddRecord(alias, trv);
        }
Exemplo n.º 3
0
        private void ReadAliasFile()
        {
            string inputAliasFile = feed.AliasFile;

            if (File.Exists(inputAliasFile))
            {
                foreach (string line in IOHelper.ExtractLine(inputAliasFile))
                {
                    if (!string.IsNullOrWhiteSpace(line))
                    {
                        string[] keyAliasPair = line.Split(new char[] { '\t', '^', ',', ',' }, StringSplitOptions.RemoveEmptyEntries);
                        if (keyAliasPair.Length != 4)
                        {
                            continue;
                        }

                        AliasKeyword value = new AliasKeyword(keyAliasPair[2].Trim(), feed.IntentionScore, feed.ProviderName);
                        float.TryParse(keyAliasPair[3], out value.Score);

                        this.TryAddRecord(keyAliasPair[0].Trim(), value);
                    }
                }
            }
        }