A Knowledge-Based Weighted KNN for Detecting Irony in Twitter

  • Delia Irazú Hernández FaríasEmail author
  • Manuel Montes-y-Gómez
  • Hugo Jair Escalante
  • Paolo Rosso
  • Viviana Patti
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11289)


In this work, we propose a variant of a well-known instance-based algorithm: WKNN. Our idea is to exploit task-dependent features in order to calculate the weight of the instances according to a novel paradigm: the Textual Attraction Force, that serves to quantify the degree of relatedness between documents. The proposed method was applied to a challenging text classification task: irony detection. We experimented with corpora in the state of the art. The obtained results show that despite being a simple approach, our method is competitive with respect to more advanced techniques.


Instance-based algorithm WKNN Irony detection 



This research was funded by CONACYT project FC 2016-2410. The work of P. Rosso has been funded by the SomEMBED TIN2015-71147-C2-1-P MINECO research project. The work of V. Patti was partially funded by Progetto di Ateneo/CSP 2016 (IhatePrejudice, S1618_L2_BOSC_01).


  1. 1.
    Barbieri, F., Basile, V., Croce, D., Nissim, M., Novielli, N., Patti, V.: Overview of the Evalita 2016 sentiment polarity classification task. In: Proceedings of Third Italian Conference on Computational Linguistics, vol. 1749. (2016)Google Scholar
  2. 2.
    Basile, V., Bolioli, A., Nissim, M., Patti, V., Rosso, P.: Overview of the Evalita 2014 sentiment polarity classification task. In: Proceedings of the First Italian Conference on Computational Linguistics, pp. 50–57 (2014)Google Scholar
  3. 3.
    Brysbaert, M., Warriner, A.B., Kuperman, V.: Concreteness ratings for 40 thousand generally known English word lemmas. Behav. Res. Met. 46(3), 904–911 (2014)CrossRefGoogle Scholar
  4. 4.
    Cambria, E., Hussain, A.: Sentic Computing, vol. 1. Springer, Cham (2015). Scholar
  5. 5.
    Cambria, E., Olsher, D., Rajagopal, D.: SenticNet 3: a common and common-sense knowledge base for cognition-driven sentiment analysis. In: Proceedings of AAAI Conference on Artificial Intelligence, pp. 1515–1521 (2014)Google Scholar
  6. 6.
    Dudani, S.A.: The distance-weighted k-nearest-neighbor rule. IEEE Trans. Syst., Man, Cybern. SMC 6(4), 325–327 (1976)CrossRefGoogle Scholar
  7. 7.
    Ghosh, A., et al.: SemEval-2015 task 11: sentiment analysis of figurative language in Twitter. In: Proceedings of the 9th International Workshop on Semantic Evaluation, pp. 470–478 (2015)Google Scholar
  8. 8.
    Giora, R., Fein, O.: Irony: context and salience. Metaphor. Symb. 14(4), 241–257 (1999)CrossRefGoogle Scholar
  9. 9.
    Gou, J., Du, L., Zhang, Y., Xiong, T.: A new distance-weighted k-nearest neighbor classifier. J. Inform. Comp. Sci. 9(6), 1429–1436 (2012)Google Scholar
  10. 10.
    Grice, H.P.: Logic and conversation. In: Cole, P., Morgan, J.L. (eds.) Syntax and Semantics: Volume 3: Speech Acts, pp. 41–58. Academic Press, San Diego (1975)Google Scholar
  11. 11.
    Hernández Farías, D.I., Patti, V., Rosso, P.: Irony detection in Twitter: the role of affective content. ACM Trans. Internet Technol. 16(3), 19:1–19:24 (2016)Google Scholar
  12. 12.
    Hernández Farías, D.I., Rosso, P.: Irony, sarcasm, and sentiment analysis. chapter 7. In: Pozzi, F.A., Fersini, E., Messina, E., Liu, B. (eds.) Sentiment Analysis in Social Networks, pp. 113–127. Morgan Kaufmann (2016)Google Scholar
  13. 13.
    Hu, M., Liu, B.: Mining and summarizing customer reviews. In: Proceedings of the 10th SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 168–177 (2004)Google Scholar
  14. 14.
    Joshi, A., Bhattacharyya, P., Carman, M.J.: Automatic sarcasm detection: a survey. ACM Comput. Surv. 50(5), 73:1–73:22 (2017)CrossRefGoogle Scholar
  15. 15.
    Mitchell, T.M.: Machine learning and data min. Com. ACM 42(11), 30–36 (1999)CrossRefGoogle Scholar
  16. 16.
    Mohammad, S.M., Turney, P.D.: Crowdsourcing a word-emotion association lexicon. Comput. Intell. 29(3), 436–465 (2013)MathSciNetCrossRefGoogle Scholar
  17. 17.
    Mohammad, S.M., Zhu, X., Kiritchenko, S., Martin, J.: Sentiment, emotion, purpose, and style in electoral tweets. Inf. Process. Manag. 51(4), 480–499 (2015)CrossRefGoogle Scholar
  18. 18.
    Plutchik, R.: The nature of emotions. Am. Sci. 89(4), 344–350 (2001)CrossRefGoogle Scholar
  19. 19.
    Reyes, A., Rosso, P., Veale, T.: A multidimensional approach for detecting irony in Twitter. Lang. Resour. Eval. 47(1), 239–268 (2013)CrossRefGoogle Scholar
  20. 20.
    Riloff, E., Qadir, A., Surve, P., Silva, L.D., Gilbert, N., Huang, R.: Sarcasm as contrast between a positive sentiment and negative situation. In: Proceedings of the Conference on Empirical Methods in Natural Language Processing, pp. 704–714. ACL (2013)Google Scholar
  21. 21.
    Skalicky, S., Crossley, S.: A statistical analysis of satirical product reviews. Eur. J. Humour Res. 2, 66–85 (2015)CrossRefGoogle Scholar
  22. 22.
    Van Hee, C., Lefever, E., Hoste, V.: SemEval-2018 task 3: irony detection in English tweets. In: Proceedings of the 12th International Workshop on Semantic Evaluation, SemEval-2018. ACL, June 2018Google Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  • Delia Irazú Hernández Farías
    • 1
    Email author
  • Manuel Montes-y-Gómez
    • 1
  • Hugo Jair Escalante
    • 1
  • Paolo Rosso
    • 2
  • Viviana Patti
    • 3
  1. 1.Instituto Nacional de Astrofísica, Óptica y Electrónica (INAOE)TonantzintlaMexico
  2. 2.PRHLT Research CenterUniversitat Politècnica de ValènciaValenciaSpain
  3. 3.Dipartimento di InformaticaUniversity of TurinTurinItaly

Personalised recommendations