public PhraseEventArgs(IWordContainer phraseContainer) { //PhraseData = phraseContainer.PhraseData; PhraseContainer = phraseContainer; Phrase = new PhraseSequence(); Phrase.Add(phraseContainer.Word); //PhraseData.GetPhraseSequence().PhraseElements[0]); }
public static PhraseSequence GetComparableSubset(this PhraseSequence p) { var comparables = from elem in p.PhraseElements where elem.Comparable select elem; PhraseSequence phrase = new PhraseSequence(); phrase.Translation = p.Translation; foreach (var e in comparables) { phrase.Add(e); } return phrase; }
public static PhraseSequence Flatten(this IEnumerable<PhraseSequence> phrases) { var p = new PhraseSequence(); foreach (var w in phrases) { p.Add(w); } return p; }
public PhraseSequence InsertContext(ContextData context) { if (context == null) { return this; } var p = new PhraseSequence(); p.Translation = Translation; foreach (var w in PhraseElements) { if (w.ElementType == PhraseSequenceElementType.ContextSlot) { var cd = context.Get(w.Text); if (cd != null) { PhraseSequence replace = cd.Data; foreach (var e in replace.PhraseElements) { p.Add(e); } p.Translation = p.Translation.Replace("[" + w.Text + "]", HelperGetTranslation(replace)); } else { p.Add(w); } } else { p.Add(w); } } return p; }
public PhraseEventArgs(PhraseSequenceElement word) { Phrase = new PhraseSequence(); Phrase.Add(word); }