Exemplo n.º 1
0
        public RelationTmp(int distance)
        {
            if (distance > 6)
            {
                distance = 6;
            }
            var count = (int)Math.Pow(5, distance);

            name2Id  = new Dictionary <string, int>(count);
            entities = new BigList <RelationEntity>();
            edgeDict = new Dictionary <long, RelationSide>(count);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="cnames">公司名列表,不可为null</param>
        /// <param name="pnames">自然人名列表,不可为null</param>
        /// <param name="distance">距离</param>
        public RelationTmp(List <string> cnames, List <string> pnames, int distance)
        {
            // 估测所有可能的实体,包括中间或临时实体,是输入实体数量的指数
            var count = cnames.Count + pnames.Count;    // -_-!!, 我相信 > 0,--

            entities_r = new List <RelationEntity>(count);

            if (distance > 4)
            {
                distance = 4;
            }
            count *= (int)Math.Pow(15, distance);

            name2Id = new Dictionary <string, int>(count);
            //names = new List<string>(count);
            entities = new BigList <RelationEntity>();
            edgeDict = new Dictionary <long, RelationSide>(count);
        }