Class: Ai::Nlp::Language
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Ai::Nlp::Language
- Defined in:
- app/models/ai/nlp/language.rb
Overview
Manages a language
Instance Method Summary collapse
-
#add_grams(given_array) ⇒ Object
Add n-grams to the language.
Instance Method Details
#add_grams(given_array) ⇒ Object
Add n-grams to the language
15 16 17 18 19 20 |
# File 'app/models/ai/nlp/language.rb', line 15 def add_grams(given_array) given_array.to_h.each do |key, freq| map[key] = map[key] ? letters + freq : freq end update end |