コード例 #1
0
 public TranscriptionChapter()
     : base()
 {
     Sections = new VirtualTypeList<TranscriptionSection>(this,this._children);
     Begin = new TimeSpan(-1);
     End = new TimeSpan(-1);
 }
コード例 #2
0
 public TranscriptionChapter(String aName, TimeSpan aBegin, TimeSpan aEnd)
 {
     Sections = new VirtualTypeList<TranscriptionSection>(this, this._children);
     this.Name = aName;
     this.Begin = aBegin;
     this.End = aEnd;
 }
コード例 #3
0
        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");
        }
コード例 #4
0
 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);
 }
コード例 #5
0
 public TranscriptionParagraph()
     : base()
 {
     Phrases = new VirtualTypeList<TranscriptionPhrase>(this, this._children);
     this.Begin = new TimeSpan(-1);
     this.End = new TimeSpan(-1);
     this.trainingElement = false;
 }
コード例 #6
0
 public TranscriptionSection()
 {
     Paragraphs = new VirtualTypeList<TranscriptionParagraph>(this,this._children);
     Begin = new TimeSpan(-1);
     End = new TimeSpan(-1);
 }
コード例 #7
0
 public TranscriptionElement()
 {
     _vChildren = new VirtualTypeList<TranscriptionElement>(this, _children);
 }