ssm.compositionality.Rd
This algorithm builds on Spike's measure of compositionality (see
sm.compositionality
), except instead of simply determining
which segment(s) have the highest mutual predictability for each
meaning feature separately, it attempts to find a combination of
non-overlapping segments for each feature that maximises the overall string
coverage over all signals. In other words, it tries to find a segmentation
which can account for (or 'explain') as much of the string material in the
signals as possible.
ssm.compositionality(x, y, groups = NULL) ssm.segmentation(x, y, mergefeatures = FALSE, verbose = FALSE)
x | a list or vector of character sequences |
---|---|
y | a matrix or data frame with as many rows as there are strings (see section Meaning data format) |
groups | a list or vector with as many items as strings, used to split the signals and meanings into data sets for which the compositionality measures are computed separately. |
mergefeatures | logical: if |
verbose | logical: if |
For large data sets and long strings, this computation can get very slow. If the attested signals are such that no perfect segmentation is possible, this algorithm is not guaranteed to find any segmentation (as no such segmentation might exist).
ssm.segmentation(c("as", "bas", "basf"), cbind(a=c(TRUE, FALSE, TRUE), b=c(FALSE, TRUE, TRUE)))#>#>#> N matches matchrate mp p segments #> b 2 2 1 1.000 0.651 b #> a 2 2 1 0.667 0.994 as #> #> Mean feature-wise mutual predictability, weighted by feature frequency: 0.833 #> Mean signal-wise character coverage, weighted by features per signal: 0.708 #> #> Segmentation is based on 3 signals totalling 9 characters. #> Discounting overlaps, the segmentation above accounts for 6 of those characters. #> Total character coverage rate: 0.667# signaling system where one meaning distinction is not encoded in the signals print(threebytwoanimals <- enumerate.meaningcombinations(list(animal=c("dog", "cat", "tiger"), colour=c("col1", "col2"))))#> animal colour #> [1,] "dog" "col1" #> [2,] "dog" "col2" #> [3,] "cat" "col1" #> [4,] "cat" "col2" #> [5,] "tiger" "col1" #> [6,] "tiger" "col2"ssm.segmentation(c("greendog", "bluedog", "greenfeline", "bluefeline", "greenfeline", "bluefeline"), threebytwoanimals)#>#>#> N matches matchrate mp p segments #> animal=dog 2 2 1 1.0 0.982 dog #> colour=col1 3 3 1 1.0 0.615 green #> colour=col2 3 3 1 1.0 0.615 blue #> animal=cat 2 2 1 0.5 1 feline #> animal=tiger 2 2 1 0.5 1 feline #> #> Mean feature-wise mutual predictability, weighted by feature frequency: 0.833 #> Mean signal-wise character coverage, weighted by features per signal: 1 #> #> Segmentation is based on 6 signals totalling 57 characters. #> Discounting overlaps, the segmentation above accounts for 57 of those characters. #> Total character coverage rate: 1# the same analysis again, but allow merging of features ssm.segmentation(c("greendog", "bluedog", "greenfeline", "bluefeline", "greenfeline", "bluefeline"), threebytwoanimals, mergefeatures=TRUE)#>#>#>#> N matches matchrate mp p segments #> animal=dog 2 2 1 1 0.982 dog #> colour=col1 3 3 1 1 0.615 green #> colour=col2 3 3 1 1 0.615 blue #> animal=cat|animal=tiger 4 4 1 1 0.701 feline #> #> Mean feature-wise mutual predictability, weighted by feature frequency: 1 #> Mean signal-wise character coverage, weighted by features per signal: 1 #> #> Segmentation is based on 6 signals totalling 57 characters. #> Discounting overlaps, the segmentation above accounts for 57 of those characters. #> Total character coverage rate: 1