gong-io / gecko

Gecko - A Tool for Effective Annotation of Human Conversations
https://gong-io.github.io/gecko/
BSD 3-Clause "New" or "Revised" License
271 stars 38 forks source link

Feature request/doc request : Change speaker id by choosing from a given list #28

Closed PaulLerner closed 4 years ago

PaulLerner commented 4 years ago

Hi again, I'd like that the user should not be able to edit the name of the speaker directly but he should be able to choose from a list. I should be able to implement it myself but I'm having problems diving into the code given the lack of technical documentation.

Bests,

strelok2012 commented 4 years ago

Hi,

First, i need to know, where you want to place the list of Speakers here or here?

If you want to use second variant, just change input to select in static/index.html file (link) and remove an 'editable' attribute from here in the same file

If i doesn't getting you right, please explain in more detail

Thank you

PaulLerner commented 4 years ago

Hi, thank you for your quick answer,

I want to place the list of speakers here https://monosnap.com/file/fNJy7uXX2f8C5RipaM72rWNNWfcPiu so it would change the speaker id of all segments of that speaker. In my application, users should not be able to add new speakers https://monosnap.com/file/lBHfkFE58YuikyZoG3Mbwpu3sOKdT1 but I guess that's pretty easy.

strelok2012 commented 4 years ago

So, you want to replace speaker list with checkboxes with one list of speakers? Each segment will have only one speaker?

so it would change the speaker id of all segments of that speaker

How you want to change a speaker for only one region? I did'nt getting how it should work from UX side, sorry

PaulLerner commented 4 years ago

No the speaker list should stay, only, instead of being able to edit the name of speaker we could have a dropdown list where each option is a speaker. Yes, each segment will have only one speaker. Currently, when you edit the name of a speaker, e.g. "Roger" → "foo". All the segments labelled as "Roger" will be labelled as "foo". That's the behaviour I want. I know it would be probably easier to just change the behaviour of the checkbox but we have another app for diarization where we want to keep the checkbox system. This feature is for an identification app where the user should not be able to change the id of a single segment (i.e. using the checkbox).

strelok2012 commented 4 years ago

Ok, got it, so, what you should do, i think:

Replace this code from index.html with single <select> with all speakers list (use select instead of ng-repeated labels, and use speakerChanged function to listen a change event)

In speakerChanged function, use iterateRegions function to find all regions with this speaker and change it

I think it should works

PaulLerner commented 4 years ago

Why should I use speakerChanged instead of speakerNameChanged ? I managed to replace the editable span by a select (see my fork). However I'm not sure how to get the updated value of the select form as I'm having trouble understanding what you did with the $scope in controller.js. Looking at this QA it seems that I should be able to get $scope.speaker as I have set ng-model="speaker".

PaulLerner commented 4 years ago

Never mind my last comment, I managed to do it (see my fork). So it looks like it's working (I used the speakerNameChanged function with only difference is I removed the check for duplicate speaker). One detail is that the color of the displayed regions waveform is not updated, although we go through updateLegend, so I'm not sure what's happening there.

strelok2012 commented 4 years ago

Hi, you need to call a regionUpdated (link) function for each region where you changed a speaker

PaulLerner commented 4 years ago

Hi, thanks for your answer. I tried that earlier but it didn't work for some reason... I managed to do it using the changeSpeakerColor function see commit where I reference this issue.

Thanks for your help !