Esempio n. 1
0
        /// <summary>Static wrapper around the class, enables computation of metaphone keys
        ///     without instantiating a class.</summary>
        ///
        /// <param name="word">Word whose metaphone keys are to be computed</param>
        /// <param name="primaryKey">Ref to var to receive primary metaphone key</param>
        /// <param name="alternateKey">Ref to var to receive alternate metaphone key, or be set to null if
        ///     word has no alternate key by double metaphone</param>
        public static void doubleMetaphone(string word, ref string primaryKey, ref string alternateKey)
        {
            DoubleMetaphone mp = new DoubleMetaphone(word);

            primaryKey   = mp.PrimaryKey;
            alternateKey = mp.AlternateKey;
        }
Esempio n. 2
0
        protected override void InternalGenerate()
        {
            IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000);
            IColor clrBlue  = AppHost.GfxProvider.CreateColor(0x0000FF);

            fTitleFont = fWriter.CreateFont("", 22f, true, false, clrBlack);
            fChapFont  = fWriter.CreateFont("", 16f, true, false, clrBlack);
            fTextFont  = fWriter.CreateFont("", 10f, false, false, clrBlack);

            fWriter.AddParagraph(fTitle, fTitleFont, TextAlignment.taLeft);

            var surnames = new StringList();

            surnames.Sorted         = true;
            surnames.DuplicateSolve = DuplicateSolve.Ignore;

            GDMTree   tree   = fBase.Context.Tree;
            var       enumer = tree.GetEnumerator(GDMRecordType.rtIndividual);
            GDMRecord record;

            while (enumer.MoveNext(out record))
            {
                var    iRec      = record as GDMIndividualRecord;
                var    nameParts = GKUtils.GetNameParts(iRec, false);
                string surname   = fBase.Context.Culture.NormalizeSurname(nameParts.Surname, iRec.Sex == GDMSex.svFemale);
                surnames.Add(surname);
            }

            fWriter.AddParagraph(SRLangMan.LS(RLS.LSID_Surnames), fChapFont, TextAlignment.taLeft);
            fWriter.BeginList();
            for (int i = 0; i < surnames.Count; i++)
            {
                string item = surnames[i];
                string primaryKey = "", alternateKey = "";
                string translit = BaseMorpher.Transliterate(TranslitScheme.ts_Russian, TranslitScheme.ts_GOST, item);
                DoubleMetaphone.doubleMetaphone(translit, ref primaryKey, ref alternateKey);
                fWriter.AddListItem(" " + item + "\t" + translit + "\t" + primaryKey + "\t" + alternateKey, fTextFont);
            }
            fWriter.EndList();
        }