COS_TEXT: Cosine similarity for text documents

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Cosine similarity for text documents

Usage

1
2
3
4
5
6
COS_TEXT(
  text_vector1 = NULL,
  text_vector2 = NULL,
  threads = 1,
  separator = " "
)

Arguments

text_vector1

a character string vector representing text documents (it should have the same length as the text_vector2)

text_vector2

a character string vector representing text documents (it should have the same length as the text_vector1)

threads

a numeric value specifying the number of cores to run in parallel

separator

specifies the separator used between words of each character string in the text vectors

Details

The function calculates the cosine distance between pairs of text sequences of two character string vectors

Value

a numeric vector

Examples

1
2
3
4
5
6
7
library(textTinyR)

vec1 = c('use this', 'function to compute the')

vec2 = c('cosine distance', 'between text sequences')

out = COS_TEXT(text_vector1 = vec1, text_vector2 = vec2, separator = " ")

mlampros/textTinyR documentation built on Nov. 1, 2021, 8:44 a.m.