Exemplo n.º 1
0
        public SmsFeatureSet(int parseId)
        {
            using (var dataContext = Dalbase.GetDataContext())
            {
                _numbers = (from result in dataContext.usp_ParsedFields_GetAllRecordPhoneNumbers_ByParseId(parseId) select result.number).ToList();

                _numbersWithType =
                    (from result in dataContext.usp_ParsedFields_GetAllRecordPhoneNumbersWithRecordType_ByParseId(parseId)
                     select new PhoneCrossRecordFeature.Tuple { Number = result.number, RecordType = result.recordType }).
                        ToList();

                //Create the phone features
                _areaCode = new AreaCodeFeature(_numbers);
                _phoneCrossRecord = new PhoneCrossRecordFeature(_numbersWithType);
                _phoneForm = new PhoneFormFeature(_numbers);
                _bigram = new BigramPerLengthFeature();

                var results = (from result in dataContext.usp_Decode_SMS_CompareAnswersToParse(parseId)
                               where result.name != null
                               select result).ToList();

                var timeStamps = (from result in results select result.timestamp.Value).ToList();

                _dateDist = new DateTimeDistanceFeature(timeStamps);

                for (int i = 0; i < results.Count; i++)
                {
                    bool isCorrect = (results[i].answer_name != null);

                    CreateFeatureRecord(dataContext, isCorrect, results[i].name, results[i].number,
                        results[i].number2, results[i].timestamp.Value, results[i].message,parseId);
                }
            }
        }
Exemplo n.º 2
0
        public AddressBookFeatureSet(int parseId)
        {
            using (var dataContext = Dalbase.GetDataContext())
            {
                _numbers = (from result in dataContext.usp_ParsedFields_GetAllRecordPhoneNumbers_ByParseId(parseId) select result.number).ToList();

                _numbersWithType =
                    (from result in dataContext.usp_ParsedFields_GetAllRecordPhoneNumbersWithRecordType_ByParseId(parseId)
                     select new PhoneCrossRecordFeature.Tuple {
                    Number = result.number, RecordType = result.recordType
                }).
                    ToList();

                //Create the phone features
                _areaCode         = new AreaCodeFeature(_numbers);
                _phoneCrossRecord = new PhoneCrossRecordFeature(_numbersWithType);
                _phoneForm        = new PhoneFormFeature(_numbers);
                _bigram           = new BigramPerLengthFeature();

                var results = (from result in dataContext.usp_Decode_AddressBook_CompareAnswersToParse(parseId)
                               where result.name != null
                               select result).ToList();



                for (int i = 0; i < results.Count; i++)
                {
                    bool isCorrect = (results[i].answer_name != null);

                    CreateFeatureRecord(dataContext, isCorrect, results[i].name, results[i].number, parseId);
                }
            }
        }