public HttpResponseMessage MathiraiCount(ProsodyText prosodyText) { var response = Request.CreateResponse(HttpStatusCode.NoContent); if (prosodyText != null && !string.IsNullOrEmpty(prosodyText.InputText)) { var prosodyParser = new ProsodyParser(prosodyText.InputText); var mathiraiCount = prosodyParser.GetMathiraiCount(); response = Request.CreateResponse(HttpStatusCode.Created, mathiraiCount); response.Headers.Location = new Uri(Request.RequestUri, string.Format("prosody/{0}", "MathiraiCount")); } return response; }
public HttpResponseMessage FindThalais(ProsodyText prosodyText) { var response = Request.CreateResponse(HttpStatusCode.NoContent); if (prosodyText != null && !string.IsNullOrEmpty(prosodyText.InputText)) { var prosodyParser = new ProsodyParser(prosodyText.InputText); var metricLinkage = prosodyParser.GetMetricAndLinkage(prosodyText.InputText); response = Request.CreateResponse(HttpStatusCode.Created, metricLinkage); response.Headers.Location = new Uri(Request.RequestUri, string.Format("prosody/{0}", "FindThalais")); } return response; }
public HttpResponseMessage Parse(TamilPaa tamilpaa) { var response = Request.CreateResponse(HttpStatusCode.NoContent); if (tamilpaa != null && !string.IsNullOrEmpty(tamilpaa.ProsodyText)) { var prosodyParser = new ProsodyParser(tamilpaa.ProsodyText, tamilpaa.ShouldParseKutriyalukaram, tamilpaa.ShouldParseVilaangaaySeer); var prosodyPart = prosodyParser.Parse(); response = Request.CreateResponse(HttpStatusCode.Created, prosodyPart); response.Headers.Location = new Uri(Request.RequestUri, string.Format("prosody/{0}", prosodyPart.MetreType)); } return response; }
//public ProsodyController() //{ //} public ProsodyController(ITamilAgarathi tamilAgarathi, ProsodyParser prosodyParser) { _tamilAgarathi = tamilAgarathi; _prosodyParser = prosodyParser; _thodaiFunctionsAndMessagesDictionary = new Dictionary<int, ThodaiFunctionsAndMessages> { {Monai, new ThodaiFunctionsAndMessages { ThodaiIndexCalculatorFunc = (s) => 0, ThodaiCheckFunc = _prosodyParser.CheckMonai, ExplanationMessages = new Dictionary<bool, string> { { true, MonaiCorrectExplanation }, { false, MonaiIncorrectExplanation } } } }, {Ethukai, new ThodaiFunctionsAndMessages { ThodaiIndexCalculatorFunc = (s) => 1, ThodaiCheckFunc = _prosodyParser.CheckEthukai, ExplanationMessages = new Dictionary<bool, string> { { true, EthukaiCorrectExplanation }, { false, EthukaiIncorrectExplanation } } } }, {Iyaipu, new ThodaiFunctionsAndMessages { ThodaiIndexCalculatorFunc = (s) => s.TamilLength() - 1, ThodaiCheckFunc = _prosodyParser.CheckIyaipu, ExplanationMessages = new Dictionary<bool, string> { { true, IyaipuCorrectExplanation }, { false, IyaipuIncorrectExplanation } } } }, }; }
public HttpResponseMessage FindAdiClass(ProsodyText prosodyText) { var response = Request.CreateResponse(HttpStatusCode.NoContent); if (!string.IsNullOrEmpty(prosodyText?.InputText)) { var prosodyParser = new ProsodyParser(prosodyText.InputText); var lineClass = prosodyParser.GetLineClass(prosodyText.InputText); response = Request.CreateResponse(HttpStatusCode.Created, lineClass); response.Headers.Location = new Uri(Request.RequestUri, $"prosody/{"FindAdiClass"}"); } return response; }
public HttpResponseMessage FindThodais(ProsodyText prosodyText) { var response = Request.CreateResponse(HttpStatusCode.NoContent); if (!string.IsNullOrEmpty(prosodyText?.InputText)) { var prosodyParser = new ProsodyParser(prosodyText.InputText); var mathiraiCount = prosodyParser.GetThodais(); response = Request.CreateResponse(HttpStatusCode.Created, mathiraiCount); response.Headers.Location = new Uri(Request.RequestUri, $"prosody/{"FindThodais"}"); } return response; }
static void Main(string[] args) { //string kural = args.Count() == 0 ? "அகர முதல எழுத்தெல்லாம் ஆதி\r\nபகவன் முதற்றே உலகு" : args[0]; //string kural = "கற்க கசடறக் கற்பவை கற்றபின்\r\nநிற்க அதற்குத் தக"; string kural = "அறிந்தானை ஏத்தி அறிவாங் கறிந்து\r\nசெறிந்தார்க்குச் செவ்வன் உரைப்ப - செறிந்தார்\r\nசிறந்தமை ஆராய்ந்து கொண்டு"; //"சச்சின வர்க்ரிக்கெ ட்டில்சாத னையாட்டம்\r\nநச்சென ஆடுவாரா மேல்சபையில் நல்லாட்டம்\r\nவேண்டும் அடித்தாடும் வேங்கைபோல் துள்ளாட்டம்\r\nவேண்டாம் தடுப்பாட் டமது"; //string[] words = kural.Split(null); //Dictionary<string, double> mathiraiCountOfWords = new Dictionary<string, double>(); //foreach (var word in words) //{ // if(word.Length > 0) // { // mathiraiCountOfWords[Transliterator.Tamil2Latin(word)] = CalculateMathirai(word); // } //} //foreach (var mathiraiCount in mathiraiCountOfWords) //{ // Console.WriteLine("{0} = {1}", mathiraiCount.Key, mathiraiCount.Value); //} ProsodyParser parodyParserTree = new ProsodyParser(kural); string InputText = "சந்தம்"; MatchCollection ms = MyRegex.Matches(InputText); var text = Transliterator.Tamil2Latin(InputText); foreach(var ugaraMeiEzuthuVagai in TamilLanguageConstants.UgaraMeiEzuthuVagaigal) { AnalyzeMeiEzuthukkal(ugaraMeiEzuthuVagai); } foreach (var uugaraMeiEzuthuVagai in TamilLanguageConstants.UugaraMeiEzuthuVagaigal) { AnalyzeMeiEzuthukkal(uugaraMeiEzuthuVagai); } int uyirEzuthuCount = kural.Count(k => k == TamilLanguageConstants.UyirEzuthukkal.Find(l => l == k)); int uyirAndUyirMeyKurilEzuthuCount = kural.Count(k => k == TamilLanguageConstants.UyirMeyKurilEzuthukkal.Find(l => l == k)); int uyirAndUyriMeyNedilEzuthuCount = kural.Count(k => k == TamilLanguageConstants.UyirMeyNedilEzuthukkal.Find(l => l == k)); int meyEzuthuCount = kural.Count(k => k == TamilLanguageConstants.MeyEzuthuPulli /* 0X0BCD - மெய்யெழுத்தில் வரும் புள்ளி. எ.கா, ’க்’ */); int aythaEzuthuCount = kural.Count(k => k == TamilLanguageConstants.AythaEzuthu); int agaraUyirMeyEzuthuCount = kural.Count(k => k == TamilLanguageConstants.AgaraUyirMeyEzuthukkal.Find(l => l == k)); int granthaEzuthuCount = kural.Count(k => k == TamilLanguageConstants.GranthaEzuthukkal.Find(l => l == k)); int uyirMeyEzuthuCount = (agaraUyirMeyEzuthuCount + granthaEzuthuCount) - meyEzuthuCount; int kurilEzuthuCount = (uyirAndUyirMeyKurilEzuthuCount + agaraUyirMeyEzuthuCount) - meyEzuthuCount - uyirAndUyriMeyNedilEzuthuCount; int nedilEzuthuCount = uyirAndUyriMeyNedilEzuthuCount; Console.WriteLine( "Uyir Ezuthukkal = {0}\r\nMey Ezuthukkal = {1}\r\nUyir Mey Ezuthukkal = {2}\r\nAytha Ezhuthukkal = {3}\r\nGrantha Ezuthukkal = {4}\r\nKuril Ezuthukkal = {5}\r\nNedil Ezuthukkal = {6}", uyirEzuthuCount, meyEzuthuCount, uyirMeyEzuthuCount, aythaEzuthuCount, granthaEzuthuCount, kurilEzuthuCount, nedilEzuthuCount); }