<jupyter_start><jupyter_text>Load demo data<jupyter_code>gauss = regulus.load('gauss4')
v = TreeView(gauss)
v<jupyter_output><empty_output><jupyter_text>Filters - Multiple filters can be provided- The first filter automatically switch to the selected attritube- The default operation is an AND of all the filters, which can be changed to And, Or, or a custom filter based on ipyregulus.filters.GroupFilter<jupyter_code>v.add_filter('span')
v.filters.op = Or()
v.filters.op = And()<jupyter_output><empty_output><jupyter_text>The group of filters can be viewed and manipulated outside of the TreeView<jupyter_code>v.filters<jupyter_output><empty_output><jupyter_text>Don't automatically show filter based on the current attribute<jupyter_code>v.auto = False<jupyter_output><empty_output><jupyter_text>change the filtering function<jupyter_code>f = v.find_filter('span')
f.func = lambda n,f: n <= f

#f.func = lambda node_value,filter_value: node_value <= filter_value<jupyter_output><empty_output><jupyter_text>filters can be shared between views<jupyter_code>v2 = TreeView(gauss)
v2
v2.add_filter(f)
v<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09823008849557523, 'fraction_numerical': 0.0035398230088495575, 'mean_word_length': 8.195121951219512, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '244514', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 394, 'n_tokens_neox': 390, 'n_words': 93, 'path': 'examples/2-filtering.ipynb', 'repo_name': 'yarden-livnat/ipyregulus', 'size': '1130'}