public TranscriptionChapter(String aName, TimeSpan aBegin, TimeSpan aEnd) { Sections = new VirtualTypeList <TranscriptionSection>(this, this._children); this.Name = aName; this.Begin = aBegin; this.End = aEnd; }
public TranscriptionChapter() : base() { Sections = new VirtualTypeList <TranscriptionSection>(this, this._children); Begin = new TimeSpan(-1); End = new TimeSpan(-1); }
public TranscriptionParagraph() : base() { Phrases = new VirtualTypeList <TranscriptionPhrase>(this, this._children); this.Begin = new TimeSpan(-1); this.End = new TimeSpan(-1); this.trainingElement = false; }
public TranscriptionSection(XElement e) { this.Paragraphs = new VirtualTypeList <TranscriptionParagraph>(this, this._children); Name = e.Attribute("name").Value; Elements = e.Attributes().ToDictionary(a => a.Name.ToString(), a => a.Value); Elements.Remove("name"); foreach (var p in e.Elements("pa").Select(p => (TranscriptionElement) new TranscriptionParagraph(p))) { Add(p); } }
public TranscriptionChapter(XElement c) { Sections = new VirtualTypeList <TranscriptionSection>(this, this._children); Name = c.Attribute("name").Value; Elements = c.Attributes().ToDictionary(a => a.Name.ToString(), a => a.Value); Elements.Remove("name"); foreach (var s in c.Elements("se").Select(s => (TranscriptionElement) new TranscriptionSection(s))) { Add(s); } }
/// <summary> /// copy constructor /// </summary> /// <param name="toCopy"></param> public TranscriptionSection(TranscriptionSection toCopy) : this() { this.Begin = toCopy.Begin; this.End = toCopy.End; this.Name = toCopy.Name; if (toCopy.Paragraphs != null) { this.Paragraphs = new VirtualTypeList <TranscriptionParagraph>(this, this._children); for (int i = 0; i < toCopy.Paragraphs.Count; i++) { this.Paragraphs.Add(new TranscriptionParagraph(toCopy.Paragraphs[i])); } } }
public TranscriptionChapter(TranscriptionChapter toCopy) : this() { this.Begin = toCopy.Begin; this.End = toCopy.End; this.Name = toCopy.Name; if (toCopy.Sections != null) { this.Sections = new VirtualTypeList <TranscriptionSection>(this, this._children); for (int i = 0; i < toCopy.Sections.Count; i++) { this.Sections.Add(new TranscriptionSection(toCopy.Sections[i])); } } }
public TranscriptionSection() { Paragraphs = new VirtualTypeList <TranscriptionParagraph>(this, this._children); Begin = new TimeSpan(-1); End = new TimeSpan(-1); }
public TranscriptionElement() { _vChildren = new VirtualTypeList <TranscriptionElement>(this, _children); }
public TranscriptionParagraph(XElement e) { if (!e.CheckRequiredAtributes("b", "e", "s")) { throw new ArgumentException("required attribute missing on paragraph (b,e,s)"); } Phrases = new VirtualTypeList <TranscriptionPhrase>(this, this._children); _internalID = int.Parse(e.Attribute("s").Value); AttributeString = (e.Attribute("a") ?? EmptyAttribute).Value; Elements = e.Attributes().ToDictionary(a => a.Name.ToString(), a => a.Value); foreach (var p in e.Elements("p").Select(p => (TranscriptionElement) new TranscriptionPhrase(p))) { Add(p); } string bfr; if (Elements.TryGetValue("a", out bfr)) { this.AttributeString = bfr; } if (Elements.TryGetValue("b", out bfr)) { int ms; if (int.TryParse(bfr, out ms)) { Begin = TimeSpan.FromMilliseconds(ms); } else { Begin = XmlConvert.ToTimeSpan(bfr); } } else { var ch = _children.FirstOrDefault(); Begin = ch == null ? TimeSpan.Zero : ch.Begin; } if (Elements.TryGetValue("e", out bfr)) { int ms; if (int.TryParse(bfr, out ms)) { End = TimeSpan.FromMilliseconds(ms); } else { End = XmlConvert.ToTimeSpan(bfr); } } else { var ch = _children.LastOrDefault(); End = ch == null ? TimeSpan.Zero : ch.Begin; } if (Elements.TryGetValue("l", out bfr)) { if (!string.IsNullOrWhiteSpace(bfr)) { Language = bfr.ToUpper(); } } Elements.Remove("b"); Elements.Remove("e"); Elements.Remove("s"); Elements.Remove("a"); Elements.Remove("l"); }