lib/langusta/detector_factory.rb
# Adds a new language profile to this factory.
# @param [LangProfile] language profile to be added.
# @param [Fixnum] index at which the language profile is to be added.
# @param [Fixnum] counts how many language profiles are to be added to this factory in total.
Adds a new language profile to this factory.
Adds a new language profile to this factory .
def add_profile(profile)
      raise DuplicateProfilesError.new(profile.name) if @lang_list.include?(profile.name)
      @lang_list << profile.name
      last_lang_index = @lang_list.size - 1
      profile.freq.keys.each do |word|
        @word_lang_prob_map[word] ||= []
        prob = 1.0 * profile.freq[word] / profile.n_words[word.length - 1]
        @word_lang_prob_map[word][last_lang_index] = prob
      end
    end
def add_profile ( profile ) raise DuplicateProfilesError . new ( profile . name ) if @lang_list . include? ( profile . name ) @lang_list << profile . name last_lang_index = @lang_list . size - 1 profile . freq . keys . each do | word | @word_lang_prob_map [ word ] ||= [ ] prob = 1.0 * profile . freq [ word ] / profile . n_words [ word . length - 1 ] @word_lang_prob_map [ word ] [ last_lang_index ] = prob end end
Adds a new language profile to this factory.
Adds a new language profile to this factory .
profile
<not_specific>
<not_specific>
counts how many language profiles are to be added to this factory in total.
counts how many language profiles are to be added to this factory in total .