# EnvironmentFilter¶

class corpustools.corpus.classes.lexicon.EnvironmentFilter(middle_segments, lhs=None, rhs=None)[source]

Filter to use for searching words to generate Environments that match

Parameters: middle_segments : set Set of segments to center environments lhs : list, optional List of set of segments on the left of the middle rhs : list, optional List of set of segments on the right of the middle

Methods

 __init__(middle_segments[, lhs, rhs]) compile_re_pattern() is_applicable(sequence) Check whether the Environment filter is applicable to the sequence lhs_count() Get the number of elements on the left hand side rhs_count() Get the number of elements on the right hand side set_lhs(lhs) set_rhs(rhs)
is_applicable(sequence)[source]

Check whether the Environment filter is applicable to the sequence (i.e., the sequence must be greater or equal in length to the EnvironmentFilter)

Parameters: sequence : list Sequence to check applicability bool True if the sequence is equal length or longer than the EnvironmentFilter
lhs_count()[source]

Get the number of elements on the left hand side

Returns: int Length of the left hand side
rhs_count()[source]

Get the number of elements on the right hand side

Returns: int Length of the right hand side