<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>and Technique⋆</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>M Saipranav</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jaswanth Sridharan</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gautham Narayan G</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Angel Deborah S</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Rajalakshmi S</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mirnalinee T T</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Samyuktaa Sivakumar</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Sri Sivasubramaniya Nadar College Of Engineering</institution>
          ,
          <addr-line>Chennai</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2024</year>
      </pub-date>
      <abstract>
        <p>In this paper, we present our work for the Automatic Humour Analysis (JOKER) Lab at CLEF 2024. The objective of the JOKER Lab is to research the automated processing of humour that includes tasks such as retrieval, classification, and interpretation of various forms of humorous texts. Our task involved the classification of humorous texts into diferent genres for which we undertook two diferent approaches. These approaches involved the usage of BERT (a transformer architecture) and a traditional machine learning model such as a Random Forest classifier. Out of the two models, BERT had a higher accuracy score of 0.6731. From this, we concluded BERT is better for most Natural Language Processes. We showcase our experiments on the training data and the results on the provided test dataset are presented in the forthcoming pages.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Humor</kwd>
        <kwd>Genre Classification</kwd>
        <kwd>BERT</kwd>
        <kwd>TF-IDF Vectors</kwd>
        <kwd>Sentence Embedding</kwd>
        <kwd>Random Forest</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Humor plays a crucial role in human communication and social interaction. However, it is multifaceted
and elicits diferent types of responses from various types of audiences. Accurate classification of humor
not only enhances our understanding of its various forms but also has practical application in fields
such as sentiment analysis, human-computer interaction and social media content moderation.</p>
      <p>Traditional humor classification techniques can be labor and time consuming. Automating this
process through NLP and ML techniques can improve the eficiency and accuracy of humor classification,
benefiting academic research. With the proliferation of digital media, humor is more pervasive and
varied than ever, presenting a challenge to even state of the art models to discern the diferences between
various genres of humor.</p>
      <p>
        The CLEF 2024 JOKER [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ][
        <xref ref-type="bibr" rid="ref2">2</xref>
        ][
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] Track comprised of 3 tasks, which were: Task 1- Humor-aware
information retrieval[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], Task 2- Humour classification according to genre and technique[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] and Task
3Translation of puns from English to French[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. We participated in task 2.
      </p>
      <p>By leveraging some advanced natural language processing techniques and fine-tuning some of the
well-known pre-trained models, this study for the chosen task - 2 aims to develop a system capable of
accurately classifying text into the following humor categories
humorous twist or reversal.</p>
      <p>proportions.
• IR - Irony relies on a gap between the literal meaning and the intended meaning, creating a
• SC - Sarcasm involves using irony to mock, criticize, or convey contempt.</p>
      <p>• EX - Exaggeration involves magnifying or overstating something beyond its normal or realistic
• AID - Incongruity refers to the unexpected or contradictory elements that are combined in a
humorous way and Absurdity involves presenting situations, events, or ideas that are inherently
illogical, irrational, or nonsensical.
• SD - Self-deprecating humor involves making fun of oneself or highlighting one’s own flaws,
weaknesses, or embarrassing situations in a lighthearted manner.
• WS - Wit refers to clever, quick, and intelligent humor and Surprise in humor involves introducing
unexpected elements, twists, or punchlines that catch the audience of guard.</p>
      <p>This automated approach significantly benefits various fields by providing deeper insights into the
mechanics of humor and enhancing the way machines understand and respond to human emotions.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Approach</title>
      <p>We took up 2 approaches for the humor classification task: multiclass classification using BERT base
uncased and classification using Random Forest classifier. Preprocessing of the data was done diferently
for both methods.</p>
      <sec id="sec-2-1">
        <title>2.1. Data Preparation</title>
        <p>
          The provided dataset [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] consisted of 1742 examples of text that must be classified into the
abovementioned 7 genres of humor. We partitioned the dataset into an 80% training dataset and a 20%
validation dataset. The content from the dataset was of the following format
        </p>
        <p>Basic text preprocessing was done to the provided dataset. Firstly, the class identifiers for each
humorous text were mapped with respective numerical values. All texts were stripped of punctuation,
stop words, and other special characters. These texts were then lemmatized. This preprocessed dataset
was directly used for BERT (see figure 1)</p>
        <p>For the approach involving the use of the Random Forest classifier, the preprocessed text data were
further prepared by combining Sentence Transformer, a pre-trained model, and Tfidf Vectorizer, a
scikit-learn tool, to generate sentence embeddings and TF-IDF feature vectors, respectively (see figure 2
)</p>
        <p>SentenceTransformer: This pre-trained model (multi-qa-mpnet-base-dot-v1) from the
sentencetransformers library is utilized to generate sentence embeddings. This model captures the semantic
meaning of text at the sentence level, efectively embedding the contextual nuances and relationships
between words within sentences.</p>
        <p>Tfidf Vectorizer : This is a tool from scikit-learn that converts textual data into TF-IDF feature vectors.
TF-IDF vectors highlight the importance of words within a document relative to the entire corpus, thus
providing a measure of the significance of terms.</p>
        <p>To generate TF-IDF vectors for the test and training data, the TF-IDF vectorizer is first fitted to the
text data within the training set. This fitting process involves learning the vocabulary and the inverse
document frequency (IDF) values from the training corpus. After fitting, the text data is transformed
into TF-IDF vectors, resulting in a sparse matrix representation of the documents where each entry
reflects the importance of a term within a document. The SentenceTransformer model encodes the
training text data into sentence embeddings, which capture the semantic content of the text. The
concatenation of TF-IDF vectors and sentence embeddings in each document creates a comprehensive
feature set that considers both local word importance and sentence semantic meaning.</p>
        <p>The target labels (classes) are extracted from the data frame to prepare the target variable for model
training and evaluation. This extraction isolates the dependent variable, which the machine learning
model will learn to predict based on the input feature set which is a combination of the TF-IDF vectors
and sentence embeddings.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Methodology</title>
        <p>
          2.2.1. BERT
BERT [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] stands for Bidirectional Encoder Representations from Transformers. It is faster and is better
at capturing context than normal Long Short Term Memory or other traditional models. BERT is
pretrained on a large corpus of text using two unsupervised learning tasks namely Masked Language Model
(MLM) and Next Sentence Prediction(NSP). In MLM, a percentage of the input tokens are randomly
masked, and the model is trained to predict the original tokens based on the context of the surrounding
words. This bidirectional context allows BERT to learn representations that capture deeper semantic
meaning. For NSP, pairs of sentences are sampled from the corpus, and the model is trained to predict
whether the second sentence follows the first one. This exercise helps BERT to understand relationships
between sentences and improves its ability to handle tasks like question answering and natural language
inference.
        </p>
        <p>
          BERT [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] consists of a stack of Transformer encoder layers. In the case of BERT Base Uncased, it has
12 such layers. Each layer contains self-attention mechanisms and feedforward neural networks.
        </p>
        <p>At every layer, BERT calculates the attention scores for each token in the input sequence, indicating
the importance of other tokens about it. This allows BERT to understand contextual information by
trying to understand all tokens in the input sequence simultaneously, in both directions. After
selfattention, the output is passed through a feedforward neural network, typically with a ReLU activation
function. This network helps find complex patterns in the data and further improves the representations
learned by the self-attention mechanism (see figure 3).</p>
        <p>Before inputting text into BERT, it undergoes tokenization into subword units using WordPiece
tokenization. This allows BERT to handle out-of-vocabulary words efectively. Each input sequence is
then represented as a combination of three types of embeddings namely token, segment, and positional
embedding. Token Embedding represents the identity of each token in the input sequence. These
embeddings are learned during the pre-training stage and understand the semantic meaning of individual
words. Segment Embedding indicates whether a token belongs to the first sentence or the second
sentence in a pair of sentences. This helps BERT understand the relationship between sentences, especially
in tasks like question answering and natural language processing. Positional Embedding encodes the
position of each token in the input sequence allowing BERT to capture sequential information and
understand the order of words in a sentence.</p>
        <p>After pre-training, BERT can be fine-tuned on specific tasks using task-specific labeled data[ 6]. During
ifne-tuning, the pre-trained parameters are adjusted to optimize performance on the task. Fine-tuning
BERT on specific tasks enables it to achieve state-of-the-art results across various natural language
processing tasks.
2.2.2. Random Forest</p>
        <p>Random Forest [7] is an ensemble classifier that contains several decision trees. Instead of using a
single decision tree, this ensemble method leverages the decision-making ability of multiple decision
trees and based on the majority number of predictions, the final output is predicted. The prepared
input feature set is passed to the Random Forest classifier comprising 1500 decision trees. (see figure
5) The use of out-of-bag samples is also enabled to estimate the generalization accuracy of the model.
This provides an internal cross-validation measure of the model performance. Decision trees make
up the most fundamental component of the Random Forest classifier. Each decision tree works to find
the best split to divide the data into multiple subsets and is trained through the Classification and
Regression Tree (CART) algorithm. Gini impurity, information gain, or mean square error are some
of the commonly used metrics to evaluate the quality of the split. A single decision tree can be prone
to bias and over-fitting, hence an ensemble classifier consisting of multiple decision trees is used to
improve the accuracy of the predictions. Random Forest algorithm (see figure 4 ) makes use of bagging
and feature randomness to create an uncorrelated forest of decision trees. Each tree in the ensemble
comprises of data sample drawn from the provided training data set with replacement. One-third of
it is set as the out-of-bag sample. The diversity of the dataset is increased and correlation among the
decision trees is reduced through feature bagging. For a classification task, such as the one performed,
the most frequent categorical variable will yield the predicted class. Finally, the out-of-bag sample is
used for cross-validation.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Results</title>
      <p>The metrics of precision, recall, accuracy, and f1-score are reported for the two models that were used
to complete the given task. Precision is calculated mathematically as the ratio of true positives and the
sum of true and false positives. Accuracy is the ratio of the number of correct predictions to the total
number of data points. Recall is calculated as the ratio of true positive and the sum of true positive and
false negative. The F1 score is calculated from the values of precision and recall. It mathematically, is
equal to twice the ratio of the product of precision and recall to the sum of precision and recall.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusions</title>
      <p>As mentioned before two diferent approaches were used to solve the given task. The first approach
involved using a transformer architecture such as BERT. The second approach involved using a
traditional machine learning model such as a Random Forest classifier. Higher accuracy (0.6731) of BERT
suggests that using transformer architecture like BERT for classification proves to be more accurate than
traditional and feature-dependent machine learning models that are commonly used for classification.
Overall, it can be concluded that BERT’s deep contextual and language understanding with its ability to
leverage transfer learning, makes it better suited for the nuanced task of humor classification according
to genre.
[6] S. Prabhu, M. Mohamed, H. Misra, Multi-class text classification using bert-based active learning,
arXiv preprint arXiv:2104.14289 (2021).
[7] G. Biau, E. Scornet, A random forest guided tour, Test 25 (2016) 197–227.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>L.</given-names>
            <surname>Ermakova</surname>
          </string-name>
          , A.-G. Bosser,
          <string-name>
            <given-names>T.</given-names>
            <surname>Miller</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V. M.</given-names>
            <surname>Palma Preciado</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Sidorov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Jatowt</surname>
          </string-name>
          , Overview of JOKER @ CLEF-2024:
          <article-title>Automatic humour analysis</article-title>
          , in: L.
          <string-name>
            <surname>Goeuriot</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          <string-name>
            <surname>Mulhem</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          <string-name>
            <surname>Quénot</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Schwab</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          <string-name>
            <surname>Soulier</surname>
          </string-name>
          ,
          <string-name>
            <surname>G. M. D. Nunzio</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          <string-name>
            <surname>Galuščáková</surname>
          </string-name>
          ,
          <string-name>
            <surname>A. G. S. de Herrera</surname>
          </string-name>
          , G. Faggioli, N. Ferro (Eds.),
          <source>Experimental IR Meets Multilinguality, Multimodality, and Interaction: Proceedings of the Fifteenth International Conference of the CLEF Association (CLEF</source>
          <year>2024</year>
          ), Lecture Notes in Computer Science, Springer, Cham,
          <year>2024</year>
          . To appear.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>L.</given-names>
            <surname>Ermakova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.-G.</given-names>
            <surname>Bosser</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Jatowt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Miller</surname>
          </string-name>
          ,
          <article-title>The joker corpus: English-french parallel data for multilingual wordplay recognition</article-title>
          ,
          <source>in: Proceedings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval</source>
          , SIGIR '23,
          <string-name>
            <surname>Association</surname>
          </string-name>
          for Computing Machinery, New York, NY, USA,
          <year>2023</year>
          , p.
          <fpage>2796</fpage>
          -
          <lpage>2806</lpage>
          . URL: https://doi.org/10.1145/3539618.3591885. doi:
          <volume>10</volume>
          .1145/3539618.3591885.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>L.</given-names>
            <surname>Ermakova</surname>
          </string-name>
          , A.-G. Bosser,
          <string-name>
            <given-names>T.</given-names>
            <surname>Miller</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Thomas-Young</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Preciado</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Sidorov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Jatowt</surname>
          </string-name>
          ,
          <source>CLEF 2024 JOKER Lab: Automatic Humour Analysis</source>
          ,
          <year>2024</year>
          , pp.
          <fpage>36</fpage>
          -
          <lpage>43</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>031</fpage>
          -56072-
          <issue>9</issue>
          _
          <fpage>5</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M. V.</given-names>
            <surname>Koroteev</surname>
          </string-name>
          ,
          <article-title>Bert: A review of applications in natural language processing</article-title>
          and understanding,
          <year>2021</year>
          . arXiv:
          <volume>2103</volume>
          .
          <fpage>11943</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>J.</given-names>
            <surname>Devlin</surname>
          </string-name>
          , M.-
          <string-name>
            <given-names>W.</given-names>
            <surname>Chang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Toutanova</surname>
          </string-name>
          , Bert:
          <article-title>Pre-training of deep bidirectional transformers for language understanding</article-title>
          , arXiv preprint arXiv:
          <year>1810</year>
          .
          <volume>04805</volume>
          (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>