This function takes as its only argument a function
f(m1, m2) which
returns a single numeric indicating the distance between two 'meanings'
m1, m2 (which are themselves most likely vectors or lists). Based
f, this function returns a function
g(mm) which takes as
its only argument a matrix or data frame
mm with the meaning
elements (equivalent to the ones in
m1, m2) along columns and
different meaning combinations (like
m1, m2, ...) along rows. This
function returns a distance matrix of class
containing all pairwise distances between the rows of
g can be passed to other functions in this
package, in particular
a function of two arguments returning a single numeric indicating the semantic distance between its arguments
The meaning distance function should be commutative, i.e.
f(a,b) = f(b,a), and meanings should have a distance of zero to
f(a,a) = 0.
A function that takes a meaning matrix and returns a corresponding
distance matrix of class
1 2 3 4 5 6 7 8 9
trivialdistance <- function(a, b) return(a - b) trivialmeanings <- as.matrix(3:1) trivialdistance(trivialmeanings, trivialmeanings) trivialdistance(trivialmeanings, trivialmeanings) trivialdistance(trivialmeanings, trivialmeanings) distmatrixfunction <- wrap.meaningdistfunction(trivialdistance) distmatrixfunction(trivialmeanings)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.