- Source:
Methods
(static) cosineSimilarityScore(seq1, seq2) → {number}
Function to calculate cosine similarity score between two strings
.Function to calculate cosine similarity score between two strings
Parameters:
Name | Type | Description |
---|---|---|
seq1 |
string | first sequence |
seq2 |
string | second sequence |
- Source:
Returns:
cosine similarity score
- Type
- number
(inner) cosineSimilarity(vecA, vecB) → {number}
Function to calculate cosine similarity between two vectors
.Function to calculate cosine similarity between two vectors
Parameters:
Name | Type | Description |
---|---|---|
vecA |
object | first vector |
vecB |
object | second vector |
- Source:
Returns:
cosine similarity between the two vectors
- Type
- number
(inner) dotProduct(vecA, vecB) → {number}
Function to calculate the dot product of two vectors
.Function to calculate the dot product of two vectors
Parameters:
Name | Type | Description |
---|---|---|
vecA |
object | first vector |
vecB |
object | second vector |
- Source:
Returns:
dot product of the two vectors
- Type
- number
(inner) magnitude(vec) → {number}
Function to calculate the magnitude of a vector
.Function to calculate the magnitude of a vector
Parameters:
Name | Type | Description |
---|---|---|
vec |
object | vector |
- Source:
Returns:
magnitude of the vector
- Type
- number
(inner) textToFreqMap(text) → {object}
Function to convert text to a frequency map
.Function to convert text to a frequency map
Parameters:
Name | Type | Description |
---|---|---|
text |
string | text to be converted |
- Source:
Returns:
frequency map of the text
- Type
- object