Ejemplo n.º 1
0
        [HttpGet("{meetingId}")]        // GET: api/addtags
        public AddtagsView Get(int meetingId)
        {
            logger.LogTrace("Get AddtagsView by meeting Id");

            AddtagsView ret = addtags.Get(meetingId);

            return(ret);
        }
Ejemplo n.º 2
0
        //public void Put(string value)
        public bool Put(AddtagsView value, long meetingId)
        {
            string workFolderPath = GetWorkFolderPath(meetingId);

            string stringValue = JsonConvert.SerializeObject(value, Formatting.Indented);

            CircularBuffer cb     = new CircularBuffer(workFolderPath, WORK_FILE_NAME, _config.MaxWorkFileBackups);
            bool           result = cb.WriteLatest(stringValue);

            return(result);
        }
Ejemplo n.º 3
0
        public AddtagsView Get(long meetingId)
        {
            string workFolderPath = GetWorkFolderPath(meetingId);

            CircularBuffer cb          = new CircularBuffer(workFolderPath, WORK_FILE_NAME, _config.MaxWorkFileBackups);
            string         latestFixes = cb.GetLatest();

            AddtagsView addtags = JsonConvert.DeserializeObject <AddtagsView>(latestFixes);

            return(addtags);
        }
        public AddtagsView ConvertFixasrToAddtags(FixasrView fixasr)
        {
            AddtagsView addtags = new AddtagsView();

            addtags.talks = new List <TalksView>();
            TalksView talk = new TalksView();

            talk.said = "";
            foreach (AsrSegment segment in fixasr.asrsegments)
            {
                string text                = segment.said;
                string speaker             = null;
                int    startNextSpokenText = 0;
                int    endLastSpokenText   = -1;
                do
                {
                    int  start        = startNextSpokenText;
                    bool isNewSpeaker = GetNextSpeaker(text, ref startNextSpokenText, ref endLastSpokenText, ref speaker);

                    // If we have the start of a new speaker, close the current talk object and start another.
                    if (isNewSpeaker)
                    {
                        // If anything said by prior speaker on this line, add it to the text.
                        if ((endLastSpokenText - start) > 0)
                        {
                            string lasttext = text.Substring(start, endLastSpokenText - start);
                            talk.said = talk.said + lasttext;
                        }
                        // If the prior speaker said anything at all, add the talk object to addtags and start a new talk object.
                        if (talk.said.Length > 0)
                        {
                            addtags.talks.Add(talk);
                            talk         = new TalksView();
                            talk.speaker = speaker;
                            talk.said    = "";
                        }
                    }
                    else
                    {
                        if (talk.said != "")
                        {
                            talk.said = talk.said + " ";
                        }
                        talk.said = talk.said + text.Substring(start);
                        break;
                    }
                } while (true);
            }
            if (talk.said.Length > 0)
            {
                addtags.talks.Add(talk);
            }
            return(addtags);
        }
Ejemplo n.º 5
0
        private void StartTagging(Meeting meeting)
        {
            string fixasrText = "";

            // TODO - Check each part of the transcribed meeting.
            // Each should contain a xxxxx-DONE.json.
            // Append them all together into fixasrText.

            bool b = true;

            if (b)
            {
                return;
            }

            FixasrView        fixasr            = JsonConvert.DeserializeObject <FixasrView>(fixasrText);
            FormatConversions formatConversions = new FormatConversions();
            AddtagsView       addtags           = formatConversions.ConvertFixasrToAddtags(fixasr);

            addtagsRepository.Put(addtags, meeting.Id);
        }
Ejemplo n.º 6
0
 [HttpPost("{meetingId}")]          // POST api/addtags
 public bool Post([FromBody] AddtagsView value, int meetingId)
 //public void Post(Addtags value)
 {
     return(addtags.Put(value, meetingId));
 }
 // This method would load transcripts for which the Addtags processing has completed.
 public void Process()
 {
     // For now we will use a single test transcript.
     AddtagsView addtags = new AddtagsView();
 }