lib/nlp_arabic/acts_as_document.rb
#To get df (or document frequency) of terms in all documents
To get df (or document frequency) of terms in all documents
To get df ( or document frequency ) of terms in all documents
def document_freq_of_terms(terms)
        df = {}
        terms.uniq.each do |t|
          term = Term.find_by_word(t)
          if term.nil?
            df[t] = 0
          else
            df[t] = term.doc_freq
          end
        end
        return df
      end
def document_freq_of_terms ( terms ) df = { } terms . uniq . each do | t | term = Term . find_by_word ( t ) if term . nil? df [ t ] = 0 else df [ t ] = term . doc_freq end end return df end
To get df (or document frequency) of terms in all documents
To get df ( or document frequency ) of terms in all documents
terms
<not_specific>