Ejemplo n.º 1
0
        public static string TryMatch2(string s, Rule R, MatchOptions2 Options)
        {
            if (s == null || s.Trim().Length == 0)
            {
                return("");
            }

            MatchOptions Options2 = Worker.GetOptions(Options);

            Padyam P = new Padyam();

            P.MatchYati       = Options2.MatchYati;
            P.MatchPrasa      = Options2.MatchPrasa;
            P.AllowSantiPrasa = Options2.AllowSantiPrasa;
            P.SandiMatch      = Options2.ExperimenatalSandhi;


            MatchResult MR = P.Match(s, R);

            if (MR.Total == 0)
            {
                return("");
            }
            return(BuildResult(R, P, MR, null, Options == null ? true : Options.ShowGV));
        }
Ejemplo n.º 2
0
 public static MatchOptions GetOptions(MatchOptions2 Options2)
 {
     if (Options2 == null)
     {
         return(Settings());
     }
     else
     {
         return(MapRules.MapOptions(Options2));
     }
 }
Ejemplo n.º 3
0
        public static Probable Determine(string s, MatchOptions2 Options2)
        {
            if (s == null || s.Trim().Length == 0)
            {
                return(null);
            }
            MatchOptions Options = Worker.GetOptions(Options2);
            Probable     Pr      = Padyam.MostProbable(s, Options);

            return(Pr);
        }
Ejemplo n.º 4
0
        public static void Beautify(Element elem, string identifier, MatchOptions2 Options2)
        {
            if (elem == null)
            {
                return;
            }

            if (identifier == "ignore")
            {
                return;
            }

            Init();

            string padyam = CleanHTML(elem.InnerHTML.ToUpperCase());
            string html   = "";

            if (Options2 == null)
            {
                Options2 = MapRules.DefaultOptions();
            }

            html = (identifier == null || identifier == "") ? Determine(padyam, Options2) : TryMatch(padyam, identifier, Options2);

            if (html != "")
            {
                elem.InnerHTML = "<div class='formatted'>" + html + "</div>" +
                                 "<div class='orginal'>" + elem.InnerHTML + "</div>";
            }

            Element Close = Util.FindByClass(elem, "open");

            if (Close == null)
            {
                return;
            }

            Util.RegisterClick3(Close, delegate(ElementEvent ee)
            {
                Element Anchor = ee.Target.ParentNode.ParentNode;
                Element Target = Util.FindByClass(Anchor, "ganaVibhajana");

                OverlayDialog OD = new OverlayDialog("", Target.InnerHTML);
                OD.FooterText    = "ఛందం<sup class='copyright'>©</sup> తో పద్యసాహిత్యం మరింత రసమయం..!! [<a target='_blank' href='http://chandam.apphb.com'>http://chandam.apphb.com</a>]";
                OD.ShowClose     = false;
                OD.Show();
            });
        }
Ejemplo n.º 5
0
        public static Chandam.Core.MatchOptions MapOptions(MatchOptions2 Options2)
        {
            if (Options2 == null)
            {
                return(null);
            }

            MatchOptions Options = new MatchOptions();

            Options.AllowSantiPrasa     = IfNotNull(Options2.AllowSantiPrasa);
            Options.ExperimenatalSandhi = IfNotNull(Options2.ExperimenatalSandhi);
            Options.IncludeRare         = IfNotNull(Options2.IncludeRare);
            Options.Language            = (Options2.Language == null) ? RuleLanguage.Telugu : (Options2.Language);
            Options.MatchPrasa          = IfNotNull(Options2.MatchPrasa);
            Options.MatchYati           = IfNotNull(Options2.MatchYati);
            Options.QuickMatch          = IfNotNull(Options2.QuickMatch);
            return(Options);
        }
Ejemplo n.º 6
0
        public static void BeautifyAll(string identifier, Element parent, MatchOptions2 Options2)
        {
            ElementCollection List = (parent == null) ? Document.GetElementsByTagName("*") : parent.GetElementsByTagName("*");

            if (List == null)
            {
                return;
            }

            Element[] L = new Element[List.Length];
            for (int i = 0; i < List.Length; i++)
            {
                L[i] = List[i];
            }
            if (Options2 == null)
            {
                Options2        = MapRules.DefaultOptions();
                Options2.ShowGV = true;
            }

            for (int i = 0; i < L.Length; i++)
            {
                Element elem        = L[i];
                string  chandam     = (string)elem.GetAttribute("chandam");
                string  identifier2 = (string)elem.GetAttribute("chandassu");

                if (chandam == "0")
                {
                    continue;
                }

                if (chandam == "1" || identifier2 != "")
                {
                    if (identifier2 != null && identifier2 != "")
                    {
                        Beautify(elem, identifier2, Options2);
                    }
                    else
                    {
                        Beautify(elem, identifier, Options2);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public static void BeautifyTags(string tag, string identifier, MatchOptions2 Options2)
        {
            ElementCollection List = Document.GetElementsByTagName(tag);

            Element[] L = new Element[List.Length];
            for (int i = 0; i < List.Length; i++)
            {
                L[i] = List[i];
            }
            if (Options2 == null)
            {
                Options2        = MapRules.DefaultOptions();
                Options2.ShowGV = true;
            }
            foreach (Element e in L)
            {
                if (e.TagName.ToLowerCase() == "div")
                {
                    return;
                }
                Beautify(e, identifier, Options2);
            }
        }
Ejemplo n.º 8
0
 public static void BeautifyId(string id, string identifier, MatchOptions2 Options2)
 {
     Beautify(Document.GetElementById(id), identifier, Options2);
 }
Ejemplo n.º 9
0
        public static string Determine(string padyam, MatchOptions2 Options2)
        {
            Probable Pr = Business.Determine(padyam, Options2);

            return(Business.BuildResult2(Pr, Options2 == null ? true : Options2.ShowGV));
        }
Ejemplo n.º 10
0
 private static string TryMatch(string padyam, string identifier, MatchOptions2 Options2)
 {
     return(Business.TryMatch(padyam, identifier, Options2));
 }
Ejemplo n.º 11
0
        public static string TryMatch(string s, string identifier, MatchOptions2 Options)
        {
            Rule R = Manager.FetchRule(identifier);

            return(TryMatch2(s, R, Options));
        }