Skip to main content
. 2023 Mar 27;9(4):77. doi: 10.3390/jimaging9040077
Algorithm 1 News similarity evaluation using cosine distance.

Input: news information n, web scraping result w, language of the search l.

Output: similarity estimation for the news pair.

  •  1:

    function cosine_distance_news_similarity(n,w,l)

  •  2:

         if type(w)isnottext then

  •  3:

             news_pair_similarity = 0

  •  4:

         end if

  •  5:

         if [l(fake),l(false),l(lie)]w then

  •  6:

              news_pair_similarity = 0

  •  7:

         end if

  •  8:

         news_pair_similarity=cosine_distance(mBERT(n),mBERT(w))

  •  9:

         return news_pair_similarity

  • 10:

    end function