Skip to content

Text structure

fact: is_text_a_list allows you to determine if a post’s text looks like a list of things. This could be useful if you want to exclude introductory posts that just list a bunch of interests. They might match your search terms but don’t really belong in your feed, for example:

I’ve been reading some great books lately and wanted to share my favorites:
- The Name of the Wind
- The Broken Earth Trilogy
- The Hobbit
- Dune
- Foundation Series
Also, I’ve been exploring new hobbies like painting, photography, and learning to play guitar.
Excited for what the new year brings!

We can look at this text and count the number of lines (8), the number of consecutive short lines (5) and the highest number of commas on a single line (2), and write a rule to determine if it looks like a list or not.

rules:
- name: Remove introductory posts
conditions:
all:
- fact: is_text_a_list
params:
max_words_in_short_line: 5 # default is 5, can be left out
max_short_lines: 3 # at least 1
max_lines: 5 # at least 1
max_commas_per_line: 1 # at least 1
operator: equal
value: true
event:
type: hide

fact: is_text_a_list will return true if either there are more than 3 short lines in a row OR more than 5 lines in total OR there is a line with more than 1 comma. Otherwise it will return false. In our example above, we happen to trigger both the lines and comma limits.