{'fraction_non_alphanumeric': 0.03426493978641218, 'fraction_numerical': 0.011860940695296524, 'mean_word_length': 4.915591397849463, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Multimodal Clustering with Role Induced Constraints for Speaker Diarization

Speaker clustering is an essential step in conventional speaker diarization systems and is typically addressed as an audio-only speech processing task. The language used by the participants in a conversation, however, carries additional information that can help improve the clustering performance. This is especially true in conversational interactions, such as business meetings, interviews, and lectures, where specific roles assumed by interlocutors (manager, client, teacher, etc.) are often associated with distinguishable linguistic patterns. In this paper we propose to employ a supervised text-based model to extract speaker roles and then use this information to guide an audio-based spectral clustering step by imposing must-link and cannot-link constraints between segments. The proposed method is applied on two different domains, namely on medical interactions and on podcast episodes, and is shown to yield improved results when compared to the audio-only approach.


Introduction
Speaker diarization is the task of segmenting a multi-party speech signal into speaker-homogeneous regions and tagging them with speaker-specific labels [1,2]. Even though recently introduced end-to-end neural diarization offers simplicity and achieves remarkable results in some scenarios [3,4], modular, clustering-based diarization is still widely used and has been an indispensable part of award-winning systems [5,6]. In the conventional diarization approach, the speech signal is first segmented into chunks assumed to be speaker-homogeneous, in the sense that a single speaker is active therein. Fixed-dimensional speaker representations are then estimated for all the segments and their pairwise similarities are computed. Finally, a clustering algorithm gives the desired labeled speech segments.
Even though it is generally assumed that no information is known a priori about the speakers, in practice we often need to deploy diarization systems in specific applications, and domaindependent processing can be used to further improve the final performance. To that end, both the acoustic [6] and the linguistic [7] streams of information have been successfully used to either adapt the models or modify the diarization pipeline. The language-based approach, where the transcripts of a recording are taken into consideration during diarization, is especially promising for interactions where speakers play dissimilar roles.
In real-life conversations, interlocutors often assume specific roles which are associated with pre-defined objectives within a group [8]. Those in turn are linked to specific communication patterns which can be manifest through the language used within the conversations. For example, during an interview the interviewer is expected to use more interrogative words than the interviewee and during a flight the air traffic controller is expected to give instructions to the pilot, who responds by reading back the instructions in a particular manner. It should be noted that several role-playing conversations, such as interviews, clinical interactions, and court hearings, have been included in the evaluation data of recent diarization challenges [9].
This role-specific linguistic variability can be used to improve the performance of core speech processing tasks, including diarization. In our previous work, we used roles to estimate the profiles of the participants in a conversation and reduce the clustering problem into a classification one [7]. In a related work, we ran audio-based speaker clustering and languagebased role recognition in parallel and then combined the outputs through a meta-classifier [10]. However, those systems assume that each speaker is linked to a unique role during a conversation. Even though this is often a reasonable assumption (e.g., dialogues between a clinician and a patient), the systems cannot be easily generalized when a single speaker assumes multiple roles or when multiple speakers play the same role (e.g., trials with a single judge and multiple prosecution witnesses).
To overcome this limitation, we propose to exploit the linguistically extracted role information to impose constraints during audio-based clustering. Depending on the domain, we can impose must-link and/or cannot-link constraints, without the need for one-to-one correspondence between speakers and roles. Using manually-derived speaker-homogeneous segments with oracle transcriptions, we evaluate the effectiveness of the approach on the clustering performance by running experiments on two domains: i) dyadic clinical interactions, and ii) multiparty interactions from a weekly radio show.

Spectral clustering for speaker diarization
Clustering is one of the main components in modular speaker diarization. During that step, speech segments are grouped into same-speaker classes, usually following either a hierarchical agglomerative clustering (HAC) [11], or a spectral clustering [12] approach. This grouping is based on the pairwise similarities (e.g., cosine-based) between the N segments to be clustered, which are stored in an affinity matrixŴ ∈ R N ×N .
Having constructed the refined affinity matrix W (where refinements are explained later), spectral clustering is a technique that exploits the eigen-decomposition of W to project the N elements onto a suitable lower-dimensional space [13]. To do so, we define the degrees di j Wij and we construct the normalized Laplacian matrix L = I − D −1/2 WD −1/2 , where D = diag{d1, d2, · · · , dN }. Assuming we know the number of speakers k, we find the k eigenvectors x1, x2, · · · , x k corresponding to the k smallest eigenvalues of L and form the matrix X = [x1|x2| · · · |x k ]. After normalizing the rows of X to unit norm, we cluster them through a k-means algorithm and assign the l-th segment to speaker s iff the l-th row is assigned to s.
In order to effectively use spectral clustering in diarization settings, several refinement operations have been proposed [12,14], the most notable being p-thresholding. During that step, the (100 − p)% largest values in each row ofŴ are set to 1 and the rest are multiplied by a small constant τ (soft thresholding), giving the modified matrixŴp. Since this operation may break the symmetry property of the affinity matrix, we re-symmetrize it to get W = 1 2 Ŵ p +Ŵ T p . Instead of fixing a specific value p, an auto-tuning approach which uses the maximum eigengap of the Laplacian matrix can be followed [14]. The eigengap criterion has its roots in graph theory and is also used to estimate the number of clusters (speakers)k, when this is not known a priori. L is a positive semi-definite matrix with N non-negative real eigenvalues 0 = λ1 ≤ λ2 ≤ · · · ≤ λN . If W is viewed as an adjacency matrix of a graph withk perfectly connected components, then k equals the multiplicity of the eigenvalue λ1 = 0. In practical applications, where we do not expect perfect components,k is estimated by the maximum eigengap ask = arg max k λ k+1 λ k .

Constrained spectral clustering
Constrained clustering extends the traditional unsupervised learning paradigm of clustering by integrating supplemental information in the form of constraints [15]. Even though several types of constraints have been explored, the most common ones are the instance-level relations, and in particular the must-link (ML) and cannot-link (CL) constraints. Under that viewpoint, if an ML (CL) constraint is imposed between two segments, then those segments must (must not) be in the same cluster. In speaker diarization, constrained clustering has been applied with constraints imposed either by human input [16], or by acquired knowledge within a particular framework [17][18][19].
Constraints can be combined with several clustering algorithms, such as k-means [20] or HAC [21]. In this work we use a constrained spectral clustering approach, where constraints are integrated via the exhaustive and efficient constraint propagation (E 2 CP) algorithm [22], which was recently applied in diarization settings [19]. Applying E 2 CP, we can propagate an initial set of pairwise constraints to the entire session. In order to do so, we define a constraint matrix Z ∈ R N ×N , such that The elements of the affinity matrixŴ are then updated aŝ where Z * contains the constraints propagated to the entire session based on the initial set of constraints and is estimated as L equalsD −1/2ŴD−1/2 , whereD is a diagonal matrix defined like D in Section 2.1, but using the degrees ofŴ. The constant α ∈ [0, 1] is a tunable hyperparameter: a small value penalizes large changes between the initial pairwise constraints in Z and the new constraints created during propagation, while a large value penalizes large changes between the neighboring segments in the graph described byŴ. Note that for α = 0 we get Z * = Z which means we only rely on the initial constraints, and for α = 1 we get Z * = 0, which means we completely ignore any constraint information. The constraint propagation and integration described here takes place before the refinement and spectral operations described in Section 2.1.

Proposed Method
In this work we propose to use a 2-step clustering for conversations where speakers assume distinct roles ( Figure 1).  Figure 1: Two-step speaker clustering for role-playing interactions. Here, an ML constraint is imposed for two segments both associated with the role "patient". Those segments have to be in the same cluster after the clustering step.
First, speaker roles are identified from text for each speech segment. To that end, we employ a BERT-based classifier [23], where we add dropout and a softmax inference layer on top of a pre-trained BERT model and we fine-tune it for the task with in-domain data. If, after classification, we have complete role information available (i.e., each segment is associated with a distinct speaker role), we can directly get a purely text-based diarization result. However, there are multiple scenarios where only partial role information is available (e.g., we have sufficient data to only train a binary classifier to identify news anchor vs. guest in a broadcast news program with multiple potential guests within a show). Additionally, we expect that there will be several segments where the linguistic content is not sufficient to robustly infer the associated speaker role.
So, we only use role information to impose suitable constraints for the following step of audio-based clustering, taking into account only segments where roles are identified with sufficient confidence. Even though neural classifiers tend to be overconfident about their decisions and softmax values are usually not a robust proxy of confidence scores, in practice we saw that we can use a softmax threshold as a threshold of confidence, as discussed in Section 5. For those segments where the confidence of their associated role is beyond some specified threshold, we impose ML and CL constraints, according to the domain we are working on. For instance, we can distinguish between the following general scenarios:

Datasets
We evaluate the proposed speaker clustering approach on two domains with role-playing interactions, as detailed below.
Psychotherapy sessions. We use a collection of psychotherapy sessions recorded at a university counseling center (UCC), and specifically the sessions in the sets denoted as UCCtrain, UCC dev and UCCtest 1 in [24]. Each session is a dyadic conversation between a therapist and a patient, thus falls under case (3) according to the categorization of Section 3. The dataset comprises 97 participants (23 therapists and 74 patients), with no speaker overlap between the train/dev/eval sets. The sessions have been professionally transcribed and the transcribed segments have been forced-aligned with the audio. More details on the dataset are provided in Table 1. Podcast episodes. This American Life 1 (TAL) is a weekly podcast and radio show. The authors in [25] have curated a dataset of 663 TAL episodes aired between 1995 and 2020. We use the audio-aligned utterances provided, with the recommended train/dev/eval split, and with the archived audio standardized as in [25]. Each episode features on average 17.7 speakers (std=8.7) with variable speaking times. The dataset, described in Table 2, has been annotated with speaker IDs and with three speaker roles, those of host, interviewer, and subject. However, the provided role information was not helpful for our purposes, since multiple speakers may play the same role within an episode and, at the same time, a single speaker may play multiple roles (with some episodes having the same speaker occasionally playing all 3 roles). So, we chose to annotate as host utterances only the ones spoken by Ira Glass and assign all the other utterances to a non-host speaker role. Ira Glass is the host and executive producer of the show and speaks for 18.6% of the time in the entire dataset 2 . Since different roles always denote different speakers (but the inverse does not hold since there are multiple non-host speakers), this dataset falls under case (1) according to the categorization given in Section 3. Of course, we should note that, since this annotation strategy is speaker-dependent, the role recognition algorithm applied is also expected to capture speaker-specific, and not purely rolespecific, information.

Experimental setup
We run experiments using manually derived speaker segments and transcriptions to avoid propagating potential errors from automated segmentation and speech recognition modules. We standardize the text by stripping punctuation, removing nonverbal vocalizations and converting all letters to lower case.
We build the binary role classifiers (therapist vs. patient and host vs. non-host) using TensorFlow [26] with the pretrained uncased English BERT-base model provided in Tensor-Flow model garden [27]. Since very short segments are not expected to have sufficient role-related information, during finetuning we only take into account segments containing at least 5 words (65.58% of the available training segments for UCC and 88.65% of the available training segments for TAL). We finetune the models for 2 epochs, using the Adam optimizer with decoupled weight decay [28], with initial learning rate equal to 2 · 10 −5 and with a warm-up stage lasting for the first 10% of the training time. The mini-batch size is set to 16 segments and the maximum allowed segment length is set to 128 tokens 3 , which means that 2.91% of the initial training UCC segments and 2.06% of the initial training TAL segments are cropped.
The speaker representation of the segments is based on the widely used x-vectors [29]. To that end, the pre-trained Vox-Celeb x-vector extractor from Kaldi [30] is used 4 and a single normalized x-vector is extracted per segment. The segments are clustered following the described constrained spectral clustering approach 5 with cosine-based affinities and with ML and/or CL constraints imposed according to the predicted associated roles. For the UCC dataset, which features dyadic interactions, we group all the segments into two clusters, while for TAL we estimate the number of speakers using the eigengap criterion searching in the range 2-50. The value of p for p-thresholding is found through auto-tuning [14], searching in the range 40-95, and we use soft thresholding with τ = 0.01 [12].
All the results are reported on the eval subsets of the data. Diarization is evaluated with respect to the diarization error rate (DER), estimated with the pyannote.metrics library [31] without allowing any tolerance collar around segment boundaries. DER incorporates three sources of error; false alarms, missed speech, and speaker confusion. However, segmentation is always the oracle one provided by human annotators and, since there is almost no speaker overlap in our datasets, by DER we essentially estimate speaker confusion (false alarm is always 0 and missed speech is 0.02% for UCC and 0.13% for TAL).

Results and discussion
If we have perfect role information for all the segments and if there is one-to-one correspondence between roles and speakers (e.g., one therapist vs. one patient in UCC), we can get a perfect diarization result in terms of speaker confusion. In the framework of constrained spectral clustering, this can be done by filling Z in eq. (1) with all the corresponding constraints and setting α = 0 in eq. (3) so that Z * = Z. This is reflected in Figure 2 where we see how DER changes as we provide more oracle constraints to the algorithm. We note that this is similar to the expected behavior when constraints are added in the form of human supervision.
Without having access to the oracle role information, we have to rely on a segment-level role classifier. After fine-tuning, the classification accuracy of the BERT-based classifiers, when only segments with at least 5 words are taken into consideration, is 83.22% for UCC (vs. 53.50% for a majority-class baseline) and 90.92% for TAL (vs. 85.41% for a majority-class baseline). Even though the classifiers provide reasonable results, we need to ensure that constraints are imposed only on segments which are confidently linked to some role. For this work, apart from only using segments longer than a specified duration (here, containing at least 5 words) to ensure some minimal linguistic content, we use the softmax values associated with the predicted roles as a proxy of the confidence level. As shown in Figure 3, the softmax value can indeed act as a reasonable proxy of confidence for our purposes. In particular, if we only consider segments where the corresponding softmax value is above some threshold, accuracy increases monotonically as a function of the threshold. However, the choice of the threshold value is a trade-off decision between accuracy and adequate support so that we have a sufficient number of constraints. For this work, we choose a threshold equal to 0.980 for UCC (accuracy = 94.66%, support = 3,222) and equal to 0.995 for TAL (accuracy = 98.15%, support = 3,674), imposing constraints on around 40% of the segments in both cases. After constructing the constraint matrix based on the described role classification only for the segments with sufficient role classification confidence, we perform the constrained spectral clustering algorithm. The results 6 are reported in the second column of Table 3. For comparison, we also provide results for the two extreme cases: i) following a conventional, unconstrained spectral clustering, which ignores any language-based information and ii) following a language-only classification, by using the results of the BERT-based classifier for all the segments, which ignores any audio-based information. 6 Those results are for α = 0.75 for UCC and α = 0.50 for TAL. In the case of the UCC data, our approach yields a small improvement (5.1% relative) compared to the unconstrained baseline. We additionally found that adding more constraints (selecting a smaller softmax threshold as our confidence criterion) leads to worse performance. Comparing this finding to the results displayed in Figure 2 with oracle constraints, where error approaches 0 given a large number of constraints, we realize that our method is sensitive to the performance of the role classifier. This is because any classification errors can be easily propagated to the clustering step ( Figure 1). This becomes more evident when we constrain all the segments, relying only on the linguistic stream of information (last column of Table 3).
For the TAL data we observe a substantial improvement going from unconstrained to constrained clustering, suggesting that in scenarios with a large number of speakers, even partial role-based information can provide useful cues that robustly guide the subsequent clustering. In more detail, we found that the imposed constraints changed the final Laplacian matrices in a way that led to the detection of more speakers per episode. The severe performance degradation with the language-only approach is expected, since the results in that case only contain two speakers (since we only have two role classes), even though each TAL episode features multiple participants.

Conclusion
We proposed to integrate text-based constraints within audiobased clustering to improve speaker diarization in role-playing conversational interactions. We implemented a BERT-based role classifier relying on text data and used its output to construct a constraint matrix for use within constrained spectral clustering. Experimental results showed that, after applying a softmax-based confidence criterion, performance can be improved both in cases of one-to-one correspondence between speakers and roles and when only partial role information is available, thus overcoming limitations of previous works.
We performed all our experiments using oracle textual information and oracle speaker segmentation. As part of future work, we intend to study the final performance with respect to the word error rate of a speech recognizer, and to errors due to non-ideal segmentation. Even though diarization is widely viewed as a pre-processing step before an automatic speech recognition (ASR) system, this conventional paradigm is often challenged by modern pipelines where the diarization algorithm utilizes ASR-derived information (e.g., [32,33]). Speaker segmentation could be included as a separate module (e.g., [7]), or incorporated within the role recognizer in a named entity recognition (NER)-like approach (e.g., [34]). Future work can also investigate different types of role-induced constraints. Even though we focused on linguistic characteristics, role-specific behaviors can also be manifest through acoustic, structural, or visual cues, all of which can be potentially used within the framework of role-dependent constrained speaker clustering.