예제 #1
0
 public ProcessedAddressBook(MetaAddressBookEntry mf)
 {
     this.MetaData = mf;
     this.InCallLog = false;
     this.SuspectPhoneNumber = false;
     this.NameBadness = 0;
 }
예제 #2
0
        private List<MetaAddressBookEntry> GetMetaAddressBookEntry(ViterbiField field, List<MetaResult> metaResults)
        {
            string name = null;
            List<string> numbers = new List<string>();
            long startOffset = long.MaxValue;
            List<long> proximityOffsets = new List<long>();

            FieldPaths path = new FieldPaths();
            for (int i = 0; i < field.Raw.Length; i++)
            {
                if (i == 0)
                {
                    path._path_beg_offset = metaResults[(int)field.OffsetFile].Field.OffsetFile;
                }
                if (i == field.Raw.Length - 1)
                {
                    path._path_end_offset = metaResults[(int)field.OffsetFile + i].Field.OffsetFile;
                }
                path._fields_in_path.Add(metaResults[(int)field.OffsetFile + i].Field.MachineName.ToString());

                if (field.Raw[i] == (byte)MetaMachine.Text && name == null)
                    name = metaResults[(int)field.OffsetFile + i].Field.FieldString;
                else if (field.Raw[i] == (byte)MetaMachine.Text)
                    name += " " + metaResults[(int)field.OffsetFile + i].Field.FieldString;
                else if (field.Raw[i] == (byte)MetaMachine.PhoneNumber)
                {
                    numbers.Add(metaResults[(int)field.OffsetFile + i].Field.FieldString);
                    proximityOffsets.Add(metaResults[(int)field.OffsetFile + i].Field.OffsetFile);
                }
                if (i == 0)
                {
                    startOffset = Math.Min(startOffset, metaResults[(int)field.OffsetFile + i].Field.OffsetFile);
                }
            }
            path.find_actual_path();
            fieldPaths.Add(path);

            var entries = new List<MetaAddressBookEntry>();

            for (int i = 0; i < numbers.Count; i++)
            {

                var entry = new MetaAddressBookEntry
                {
                    Name = name,
                    Number = numbers[i],
                    SevenDigit = Utilities.GetLastSevenDigits(numbers[i]),
                    Offset = startOffset,
                    MachineName = field.MachineName,
                    ProximityOffset = proximityOffsets[i]
                };

                if (entry.Name == null)
                    entry.Name = MetaField.DEFAULT_STRING;

                if (entry.Number == null)
                    entry.Number = MetaField.DEFAULT_STRING;

                if (entry.SevenDigit == null)
                    entry.SevenDigit = MetaField.DEFAULT_STRING;

                entries.Add(entry);

            }

            return entries;
        }
예제 #3
0
 private bool CompareNumbers2(MetaAddressBookEntry mabe, MetaSms msms)
 {
     if ((mabe.Number != null) && (msms.Number2 != null) &&
         (mabe.Number != MetaField.DEFAULT_STRING) && (mabe.Number == msms.Number2)) {
         return true;
     }
     if ((mabe.Number != null) && (msms.Number2 != null)) {
         string acode1 = Dec0de.Bll.Utilities.GetAreaCode(mabe.Number);
         string acode2 = Dec0de.Bll.Utilities.GetAreaCode(msms.Number2);
         if ((acode1 != null) && (acode2 != null) && (acode1 != acode2)) {
             return false;
         }
     }
     if ((mabe.SevenDigit != null) && (msms.SevenDigit2 != null) &&
         (mabe.SevenDigit != MetaField.DEFAULT_STRING) && (mabe.SevenDigit == msms.SevenDigit2)) {
         return true;
     }
     return false;
 }
예제 #4
0
        public List<MetaAddressBookEntry> GetMetaAddressBookEntry(ViterbiField field, List<MetaResult> metaResults)
        {
            string name = null;
            List<string> numbers = new List<string>();
            long startOffset = long.MaxValue;

            for (int i = 0; i < field.Raw.Length; i++)
            {
                if (field.Raw[i] == (byte)MetaMachine.Text && name == null)
                    name = metaResults[(int)field.OffsetFile + i].Field.FieldString;
                else if (field.Raw[i] == (byte)MetaMachine.Text)
                    name += " " + metaResults[(int)field.OffsetFile + i].Field.FieldString;
                else if (field.Raw[i] == (byte)MetaMachine.PhoneNumber)
                    numbers.Add(metaResults[(int)field.OffsetFile + i].Field.FieldString);
                if (i == 0)
                    startOffset = Math.Min(startOffset, metaResults[(int)field.OffsetFile + i].Field.OffsetFile);
            }

            var entries = new List<MetaAddressBookEntry>();

            for (int i = 0; i < numbers.Count; i++)
            {

                var entry = new MetaAddressBookEntry
                                {
                                    Name = name,
                                    Number = numbers[i],
                                    SevenDigit = Utilities.GetLastSevenDigits(numbers[i]),
                                    Offset = startOffset
                                };

                if (entry.Name == null)
                    entry.Name = MetaField.DEFAULT_STRING;

                if (entry.Number == null)
                    entry.Number = MetaField.DEFAULT_STRING;

                if (entry.SevenDigit == null)
                    entry.SevenDigit = MetaField.DEFAULT_STRING;

                entries.Add(entry);

            }

            return entries;
        }
예제 #5
0
 private bool CompareNumbers(MetaAddressBookEntry mabe, MetaSms msms)
 {
     if (CompareNumbers1(mabe, msms)) {
         return true;
     }
     return CompareNumbers2(mabe, msms);
 }