Learn R Programming

textTinyR (version 1.1.8)

cosine_distance: cosine distance of two character strings (each string consists of more than one words)

Description

cosine distance of two character strings (each string consists of more than one words)

Usage

cosine_distance(sentence1, sentence2, split_separator = " ")

Value

a float number

Arguments

sentence1

a character string consisting of multiple words

sentence2

a character string consisting of multiple words

split_separator

a character string specifying the delimiter(s) to split the sentence

Examples

Run this code

library(textTinyR)

sentence1 = 'this is one sentence'

sentence2 = 'this is a similar sentence'

cds = cosine_distance(sentence1, sentence2)

Run the code above in your browser using DataLab