(self, ref_or_cat, lang="he", dependents_regex=None)
:param ref_or_cat:
        :param lang:
        :param dependents_regex: string - filter dependents by those that have this string (treat this as a category))
        :return:
:param ref_or_cat:
        :param lang:
        :param dependents_regex: string - filter dependents by those that have this string (treat this as a category))
        :return:
: param ref_or_cat : : param lang : : param dependents_regex : string - filter dependents by those that have this string ( treat this as a category )) : return :
def word_count(self, ref_or_cat, lang="he", dependents_regex=None):
        """
        :param ref_or_cat:
        :param lang:
        :param dependents_regex: string - filter dependents by those that have this string (treat this as a category))
        :return:
        """
        if isinstance(ref_or_cat, Ref):
            return ref_or_cat.word_count(lang)
        try:
            return Ref(ref_or_cat).word_count(lang)
        except InputError:
            if dependents_regex:
                raw_ins = library.get_indexes_in_category(ref_or_cat, True)
                ins = filter(lambda s: re.search(dependents_regex,s), raw_ins)
            else:
                ins = library.get_indexes_in_category(ref_or_cat)
            return sum([Ref(r).word_count(lang) for r in ins])
def word_count ( self , ref_or_cat , lang = "he" , dependents_regex = None ) : if isinstance ( ref_or_cat , Ref ) : return ref_or_cat . word_count ( lang ) try : return Ref ( ref_or_cat ) . word_count ( lang ) except InputError : if dependents_regex : raw_ins = library . get_indexes_in_category ( ref_or_cat , True ) ins = filter ( lambda s : re . search ( dependents_regex , s ) , raw_ins ) else : ins = library . get_indexes_in_category ( ref_or_cat ) return sum ( [ Ref ( r ) . word_count ( lang ) for r in ins ] )