generate_single_region {biogram}R Documentation

Generate single region

Description

Generate a region using an alphabet of unigrams and considering provided set of rules.

Usage

generate_single_region(alphabet, reg_len, prop_ranges, exactness)

Arguments

alphabet

the unigram alphabet. Columns are equivalent to unigrams and rows to particular properties.

reg_len

the number of unigrams inside the region.

prop_ranges

required intervals of properties of unigrams in the region. See Details.

exactness

a numeric value between 0 and 1 defining how stricly unigrams are kept within prop_ranges. If 1, only unigrams within prop_ranges are inside the region. if 0.9, there is 10 unigrams that are not in the prop_ranges will be inside the region.

Examples

props1 <- list(P1 = c(0, 0.5), 
               P2 = c(0.2, 0.4),
               P3 = c(0.5, 1),
               P4 = c(0, 0))

props2 <- list(P1 = c(0.5, 1), 
               P2 = c(0.4, 1),
               P3 = c(0, 0.5),
               P4 = c(1, 1))


alph <- generate_unigrams(c(replicate(8, props1, simplify = FALSE),
                            replicate(12, props2, simplify = FALSE)),
                          unigram_names = letters[1L:20])

rules1 <- list(P1 = c(0.5, 1), 
               P2 = c(0.4, 1),
               P3 = c(0, 0.5),
               P4 = c(1, 1))

generate_single_region(alph, 10, rules1, 0.9)

[Package biogram version 1.6.3 Index]