Esempio n. 1
0
 public static ILexicalContextmenu Create(this ILexical lexical)
 {
     Validate.NotNull(lexical, nameof(lexical));
     return(lexical.Match()
            .Case((IReferencer r) => CreateForReferencer(r))
            .Case((IVerbal v) => CreateForVerbal(v))
            .Result());
 }
Esempio n. 2
0
 private static IEnumerable <JProperty> GetStructuralProperties(ILexical element) =>
 from result in element.Match()
 .Case((Phrase p) => new JProperty("words", p.Words.ToJArray()))
 .Case((Clause c) => new JProperty("phrases", c.Phrases.ToJArray()))
 select result;
Esempio n. 3
0
 /// <summary>
 /// Creates a Newtonsoft.Linq.JObject representation of the lexical.
 /// </summary>
 /// <param name="lexical">The source entity.</param>
 /// <returns>A Newtonsoft.Linq.JObject representation of the lexical.</returns>
 public static JObject ToJObject(this ILexical lexical) => lexical.Match()
 .Case((IEntity e) => e.ToJObject())
 .Case((IVerbal v) => v.ToJObject())
 .Case((IAdverbial a) => a.ToJObject())
 .Result(new JObject(GetRoleIndependentProperties(lexical)));