public static KnownPerson CreateKnownPerson(string firstName, string lastName, bool isMale = true) { firstName = firstName.Trim().ToLower(); lastName = lastName.Trim().ToLower(); var petrovich = new MyOwnPetrovich(); petrovich.SetGender(isMale ? Gender.Male : Gender.Female); petrovich.SetNominative(firstName, "", lastName); var knownPerson = new KnownPerson() { NominativeName = firstName, NominativeSurname = lastName, AccusativeName = petrovich.InflectFirstNameTo(Case.Accusative), AccusativeSurname = petrovich.InflectLastNameTo(Case.Accusative), DativeName = petrovich.InflectFirstNameTo(Case.Dative), DativeSurname = petrovich.InflectLastNameTo(Case.Dative), GenitiveName = petrovich.InflectFirstNameTo(Case.Genitive), GenitiveSurname = petrovich.InflectLastNameTo(Case.Genitive), InstrumentalName = petrovich.InflectFirstNameTo(Case.Instrumental), InstrumentalSurname = petrovich.InflectLastNameTo(Case.Instrumental), PrepositionalName = petrovich.InflectFirstNameTo(Case.Prepositional), PrepositionalSurname = petrovich.InflectLastNameTo(Case.Prepositional) }; return(knownPerson); }
string InflateAndReturnRegexPattern(string word) { _petrovich.SetNominative(word); _petrovich.SetGender(Gender.Male); var words = new [] { _petrovich.InflectFirstNameTo(Case.Accusative), _petrovich.InflectFirstNameTo(Case.Dative), _petrovich.InflectFirstNameTo(Case.Genitive), _petrovich.InflectFirstNameTo(Case.Instrumental), _petrovich.InflectFirstNameTo(Case.Prepositional), word }; return (String.Format("({0})", String.Join("|", words))); }
KnownName CreateKnownName(string name, bool isMale) { _petrovich.SetGender(isMale ? Gender.Male : Gender.Female); _petrovich.SetNominative(firstName: name); var knownName = new KnownName() { Accusative = _petrovich.InflectFirstNameTo(Case.Accusative), Dative = _petrovich.InflectFirstNameTo(Case.Dative), Genitive = _petrovich.InflectFirstNameTo(Case.Genitive), Instrumental = _petrovich.InflectFirstNameTo(Case.Instrumental), Nominative = _petrovich.InflectFirstNameTo(Case.Nominative), Prepositional = _petrovich.InflectFirstNameTo(Case.Prepositional), IsMale = isMale }; return(knownName); }
public static KnownName CreateKnownName(string name, bool isMale) { var petrovich = new MyOwnPetrovich(); petrovich.SetGender(isMale ? Gender.Male : Gender.Female); petrovich.SetNominative(firstName: name); var knownName = new KnownName() { Accusative = petrovich.InflectFirstNameTo(Case.Accusative), Dative = petrovich.InflectFirstNameTo(Case.Dative), Genitive = petrovich.InflectFirstNameTo(Case.Genitive), Instrumental = petrovich.InflectFirstNameTo(Case.Instrumental), Nominative = petrovich.InflectFirstNameTo(Case.Nominative), Prepositional = petrovich.InflectFirstNameTo(Case.Prepositional), IsMale = isMale }; Context.Default.KnownNames.Add(knownName); Context.Default.SaveChanges(); return(knownName); }