parameters: (self, sources)
return_statement: return filtered
docstring: Filter LinkSet according to 'sources' which may be either
          - a string, naming a text or category to include
          - an array of strings, naming multiple texts or categories to include
  
          ! Returns a list of Links, not a LinkSet
docstring_summary: Filter LinkSet according to 'sources' which may be either
          - a string, naming a text or category to include
          - an array of strings, naming multiple texts or categories to include
docstring_tokens: Filter LinkSet according to sources which may be either - a string naming a text or category to include - an array of strings naming multiple texts or categories to include
function: def filter(self, sources):
          """
          Filter LinkSet according to 'sources' which may be either
          - a string, naming a text or category to include
          - an array of strings, naming multiple texts or categories to include
  
          ! Returns a list of Links, not a LinkSet
          """
          if isinstance(sources, str):
              return self.filter([sources])
  
          # Expand Categories
          categories = text.library.get_text_categories()
          expanded_sources = []
          for source in sources:
              expanded_sources += [source] if source not in categories else text.library.get_indexes_in_category(source)
  
          regexes = [text.Ref(source).regex() for source in expanded_sources]
          filtered = []
          for source in self:
              if any([re.match(regex, source.refs[0]) for regex in regexes] + [re.match(regex, source.refs[1]) for regex in regexes]):
                  filtered.append(source)
  
          return filtered
function_tokens: def filter ( self , sources ) : if isinstance ( sources , str ) : return self . filter ( [ sources ] ) # Expand Categories categories = text . library . get_text_categories ( ) expanded_sources = [ ] for source in sources : expanded_sources += [ source ] if source not in categories else text . library . get_indexes_in_category ( source ) regexes = [ text . Ref ( source ) . regex ( ) for source in expanded_sources ] filtered = [ ] for source in self : if any ( [ re . match ( regex , source . refs [ 0 ] ) for regex in regexes ] + [ re . match ( regex , source . refs [ 1 ] ) for regex in regexes ] ) : filtered . append ( source ) return filtered