public void SuruSpecial(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative) { var word = "愛する"; var wordClass = EdictType.vs_s; Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity)); }
public void IchidanKureru(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative) { var word = "くれる"; var wordClass = EdictType.v1_s; Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity)); }
public void IrregularNu(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative) { var word = "死ぬ"; var wordClass = EdictType.vn; Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity)); }
public void GodanIkuYuku(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative) { var word = "合点がいく"; // also 冴え行く var wordClass = EdictType.v5k_s; Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity)); }
public void GodanAru(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative) { var word = "いらっしゃる"; var wordClass = EdictType.v5aru; Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity)); }
public Task <Option <RichFormatting> > Answer(Request request, CancellationToken token) { var rich = new RichFormatting(); if (!(request.PartOfSpeech == PartOfSpeech.Verb || request.PartOfSpeech == PartOfSpeech.Unknown)) { rich.Paragraphs.Add( new TextParagraph( EnumerableExt.OfSingle( new Text("The program estimates this word is not a verb. The results below may be garbage.")))); } var verb = request.NotInflected ?? request.Word.RawWord; var entries = jdict.Lookup(verb); if (entries == null) { rich.Paragraphs.Add( new TextParagraph( EnumerableExt.OfSingle( new Text("No word found.")))); return(Task.FromResult(Option.Some(rich))); } var verbTypes = entries.Select(e => { if (!e.ReadingEntries.Any()) { return(Option.None <EdictType>()); } return(GetEdictVerbType(e)); }) .OfNonNone() .Distinct() .OrderByDescending(e => Option.Some((int)e) == request.Word.Type.Map(t => (int)t) ? 1 : 0) .ToList(); if (verbTypes.Count == 0) { rich.Paragraphs.Add( new TextParagraph( EnumerableExt.OfSingle( new Text("No verb found.")))); return(Task.FromResult(Option.Some(rich))); } else { foreach (var verbType in verbTypes) { if (verbTypes.Count > 1) { rich.Paragraphs.Add(new TextParagraph( EnumerableExt.OfSingle(new Text(verb + ": " + LibJpConjSharp.EdictTypeUtils.ToLongString(verbType))))); } rich.Paragraphs.Add(new TextParagraph(new[] { Form("=", CForm.Present, verbType), Form("@=", CForm.Present, verbType, Politeness.Polite), Form("<", CForm.Past, verbType), Form("?", CForm.Potential, verbType), Form("#", CForm.Passive, verbType), Form("->", CForm.Causative, verbType), Form("if", CForm.Condition, verbType), Form("Te", CForm.TeForm, verbType), Form("!", CForm.Imperative, verbType), Form(":D", CForm.Volitional, verbType), })); } } rich.Paragraphs.Add(new TextParagraph(EnumerableExt.OfSingle(new Text( @"= - Present < - Past ? - Potential # - Passive -> - Causative if - Conditional Te - Te Form ! - Imperative :D - Volitional ~ - Negative form of any of those @ - Polite form ")))); return(Task.FromResult(Option.Some(rich))); Text Form(string name, CForm form, EdictType type, Politeness politeness = Politeness.Plain) { return(new Text( $"{name}: {JpConj.Conjugate(verb, type, form, politeness).Replace("|", "")}\n~{name}: {JpConj.Conjugate(verb, type, form, politeness, Polarity.Negative).Replace("|", "")}\n")); } }