Class TranscriptSpeakers
java.lang.Object
org.exoplatform.documents.model.TranscriptSpeakers
Reads who the speakers of a transcript are and writes its lines, with no
service behind it, for any module that sees the documents API only
(EXO-92123). A speaker is stored as
<speaker>=<identityId> for a
person with an account, or <speaker>=name:<text> for a guest named
by a plain name. What is written is meant for an assistant, so it is never
localised.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatLine(double start, String name, String text) Writes one line of a timed transcript: the moment it was said, asformatMarker(double)marks it, then who said it.static StringformatMarker(double seconds) Writes a moment of a media as the documents tools mark it for an assistant, with the whole seconds an assistant can jump to.static StringformatMoment(double seconds) Writes a moment of a media.static StringformatTurn(String name, String text) Writes one turn of a transcript with no moment.static StringReads the guest name a stored speaker value holds.static booleanTells whether a stored speaker value is a guest's plain name.static StringspeakerName(String speaker, Map<String, String> speakers, Function<String, String> fullNameOfIdentity) Names a speaker of a transcript: the full name of the person named for it, the guest's name, orSpeaker Nwhen nobody is named, when the person is gone, or when the lookup finds no name.
-
Field Details
-
GUEST_PREFIX
The prefix of a stored guest name, matched case-sensitively.- See Also:
-
SPEAKER_LABEL
The label of a speaker nobody named, followed by its number.- See Also:
-
-
Method Details
-
isGuest
Tells whether a stored speaker value is a guest's plain name.- Parameters:
value- the stored value- Returns:
- true when the value starts with
GUEST_PREFIX
-
guestName
Reads the guest name a stored speaker value holds.- Parameters:
value- the stored value- Returns:
- the text after
GUEST_PREFIX, or null when the value is no guest name
-
speakerName
public static String speakerName(String speaker, Map<String, String> speakers, Function<String, String> fullNameOfIdentity) Names a speaker of a transcript: the full name of the person named for it, the guest's name, orSpeaker Nwhen nobody is named, when the person is gone, or when the lookup finds no name.- Parameters:
speaker- the speaker's number in the transcript, or null for a sentence the transcript gives no speakerspeakers- the stored value of each named speaker, by speaker numberfullNameOfIdentity- gives the full name of a person from their identity id, or null when there is none- Returns:
- the speaker's name; null when the sentence has no speaker, which
formatLine(double, String, String)andformatTurn(String, String)then write without a name
-
formatMoment
Writes a moment of a media.- Parameters:
seconds- the moment, in seconds from the beginning of the media; its fraction is dropped, and a negative or undefined moment is 0- Returns:
mm:ss, orh:mm:sspast an hour
-
formatMarker
Writes a moment of a media as the documents tools mark it for an assistant, with the whole seconds an assistant can jump to.- Parameters:
seconds- the moment, in seconds from the beginning of the media; its fraction is dropped, and a negative or undefined moment is 0- Returns:
[mm:ss · Ns], or[h:mm:ss · Ns]past an hour, N being the moment in whole seconds
-
formatLine
Writes one line of a timed transcript: the moment it was said, asformatMarker(double)marks it, then who said it.- Parameters:
start- the moment the line was said, in secondsname- who said it, or null when the transcript does not telltext- what was said- Returns:
[mm:ss · Ns] Name: text, or[mm:ss · Ns] textwhen the name is null
-
formatTurn
-