<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Windows.UI.Xaml.Media.Imaging;

namespace ImdbInterface {
    public class Person : INotifyPropertyChanged {
        private const string IMDB_BASE_URI = "http://www.imdb.com/title/";
        private const string URI_NOT_VALID = "Not a valid IMDb uri";
        private const string ID_NOT_VALID = "Not a valdi IMDb ID";
        private const string IMDB_ID_REGEX = @"\bnm\d+\b";
        public event PropertyChangedEventHandler PropertyChanged;

        #region Constructors
        public Person() { }

        public Person(string imdbId) {
            if(imdbId == null) throw new ArgumentNullException(ID_NOT_VALID);
            ImdbId = imdbId;
        }

        public Person(Uri imdbUri) {
            if(imdbUri == null) throw new ArgumentNullException(URI_NOT_VALID);
            ImdbId = ParseImdbUri(imdbUri);
        }
        #endregion

        #region Parsers
        private string ParseImdbUriString(string imdbUriString) {
            var match = Regex.Match(imdbUriString, IMDB_ID_REGEX, RegexOptions.IgnoreCase);
            if(match.Success) return match.Value;
            else throw new ArgumentException(URI_NOT_VALID);
        }

        private string ParseImdbUri(Uri imdbUri) {
            return ParseImdbUriString(imdbUri.ToString());
        }
        #endregion

        private bool CheckValidity(string imdbId) {
            return Regex.IsMatch(imdbId, IMDB_ID_REGEX, RegexOptions.IgnoreCase);
        }

        #region Properties
        private string _imdbId;
        public string ImdbId {
            get { return _imdbId; }

            set {
                if(value != _imdbId) {
                    _imdbId = value;
                    OnPropertyChanged("ImdbId");
                }
            }
        }

        public Uri WebUri { get { return new Uri(IMDB_BASE_URI + ImdbId); } }

        private DateTime _lastFetch;
        public DateTime LastFetch {
            get { return _lastFetch; }

            set {
                if(value != _lastFetch) {
                    _lastFetch = value;
                    OnPropertyChanged("LastFetch");
                }
            }
        }

        private Uri _posterThumbnailUri;
        public Uri PosterThumbnailUri {
            get { return _posterThumbnailUri; }

            set {
                if(value != _posterThumbnailUri) {
                    _posterThumbnailUri = value;
                    OnPropertyChanged("PosterThumbnailUri");
                }
            }
        }

        private Uri _posterUri;
        public Uri PosterUri {
            get { return _posterUri; }

            set {
                if(value != _posterUri) {
                    _posterUri = value;
                    OnPropertyChanged("PosterUri");
                }
            }
        }

        private BitmapImage _poster;
        public BitmapImage Poster {
            get { return _poster; }

            set {
                if(value != _poster) {
                    _poster = value;
                    OnPropertyChanged("Poster");
                }
            }
        }

        private string _name;
        public string Name {
            get { return _name; }

            set {
                if(CheckValidity(value)) {
                    if(value != _name) {
                        _name = value;
                        OnPropertyChanged("Name");
                    }
                } else throw new ArgumentException(ID_NOT_VALID);
            }
        }

        private string _description;
        public string Description {
            get { return _description; }

            set {
                if(value != _description) {
                    _description = value;
                    OnPropertyChanged("Description");
                }
            }
        }

        private DateTime _birthDate;
        public DateTime BirthDate {
            get { return _birthDate; }

            set {
                if(value != _birthDate) {
                    _birthDate = value;
                    OnPropertyChanged("BirthDate");
                }
            }
        }

        private string _birthPlace;
        public string BirthPlace {<commit_msg>Add JobTitles property<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Windows.UI.Xaml.Media.Imaging;

namespace ImdbInterface {
    public class Person : INotifyPropertyChanged {
        private const string IMDB_BASE_URI = "http://www.imdb.com/title/";
        private const string URI_NOT_VALID = "Not a valid IMDb uri";
        private const string ID_NOT_VALID = "Not a valdi IMDb ID";
        private const string IMDB_ID_REGEX = @"\bnm\d+\b";
        public event PropertyChangedEventHandler PropertyChanged;

        #region Constructors
        public Person() { }

        public Person(string imdbId) {
            if(imdbId == null) throw new ArgumentNullException(ID_NOT_VALID);
            ImdbId = imdbId;
        }

        public Person(Uri imdbUri) {
            if(imdbUri == null) throw new ArgumentNullException(URI_NOT_VALID);
            ImdbId = ParseImdbUri(imdbUri);
        }
        #endregion

        #region Parsers
        private string ParseImdbUriString(string imdbUriString) {
            var match = Regex.Match(imdbUriString, IMDB_ID_REGEX, RegexOptions.IgnoreCase);
            if(match.Success) return match.Value;
            else throw new ArgumentException(URI_NOT_VALID);
        }

        private string ParseImdbUri(Uri imdbUri) {
            return ParseImdbUriString(imdbUri.ToString());
        }
        #endregion

        private bool CheckValidity(string imdbId) {
            return Regex.IsMatch(imdbId, IMDB_ID_REGEX, RegexOptions.IgnoreCase);
        }

        #region Properties
        private string _imdbId;
        public string ImdbId {
            get { return _imdbId; }

            set {
                if(value != _imdbId) {
                    _imdbId = value;
                    OnPropertyChanged("ImdbId");
                }
            }
        }

        public Uri WebUri { get { return new Uri(IMDB_BASE_URI + ImdbId); } }

        private DateTime _lastFetch;
        public DateTime LastFetch {
            get { return _lastFetch; }

            set {
                if(value != _lastFetch) {
                    _lastFetch = value;
                    OnPropertyChanged("LastFetch");
                }
            }
        }

        private Uri _posterThumbnailUri;
        public Uri PosterThumbnailUri {
            get { return _posterThumbnailUri; }

            set {
                if(value != _posterThumbnailUri) {
                    _posterThumbnailUri = value;
                    OnPropertyChanged("PosterThumbnailUri");
                }
            }
        }

        private Uri _posterUri;
        public Uri PosterUri {
            get { return _posterUri; }

            set {
                if(value != _posterUri) {
                    _posterUri = value;
                    OnPropertyChanged("PosterUri");
                }
            }
        }

        private BitmapImage _poster;
        public BitmapImage Poster {
            get { return _poster; }

            set {
                if(value != _poster) {
                    _poster = value;
                    OnPropertyChanged("Poster");
                }
            }
        }

        private string _name;
        public string Name {
            get { return _name; }

            set {
                if(CheckValidity(value)) {
                    if(value != _name) {
                        _name = value;
                        OnPropertyChanged("Name");
                    }
                } else throw new ArgumentException(ID_NOT_VALID);
            }
        }

        private List<string> _jobTitles;
        public List<string> JobTitles {
            get { return _jobTitles; }

            set {
                if(value != _jobTitles) {
                    _jobTitles = value;
                    OnPropertyChanged("JobTitles");
                }
            }
        }

        private string _description;
        public string Description {
            get { return _description; }

            set {
                if(value != _description) {
                    _description = value;
                    OnPropertyChanged("Description");
                }
            }
        }

        private DateTime _birthDate;
        public DateTime BirthDate {
            get { return _birthDate; }

            set {
                if(value != _birthDate) {
                    _birthDate = value;
                    OnPropertyChanged("BirthDate");
                }
            }
        }

        private string _birthPlace;
        public string BirthPlace {
{'fraction_non_alphanumeric': 0.0733633073801952, 'fraction_numerical': 0.0, 'mean_word_length': 1.3911903513371788, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4974912', 'n_tokens_mistral': 2434, 'n_tokens_neox': 2295, 'n_words': 523}