Module: LightModels::InfoExtraction
- Defined in:
- lib/lightmodels/info_extraction.rb
Defined Under Namespace
Classes: TermsBreaker
Class Method Summary collapse
- .terms_map(language_specific_logic, model_node, context = nil) ⇒ Object
- .values_map(model_node) ⇒ Object
Class Method Details
.terms_map(language_specific_logic, model_node, context = nil) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/lightmodels/info_extraction.rb', line 108 def self.terms_map(language_specific_logic,model_node,context=nil) # context default to root unless context context = model_node while context.eContainer context = context.eContainer end end # look into context to see how frequent are certain series of words, # frequent series are recognized as composed terms terms_breaker = TermsBreaker.from_context(language_specific_logic,context) values_map = values_map(model_node) terms_map = Hash.new {|h,k| h[k]=0} values_map.each do |v,n| terms_breaker.terms_in_value(v).each do |t| terms_map[t] += n end end terms_map end |
.values_map(model_node) ⇒ Object
103 104 105 106 |
# File 'lib/lightmodels/info_extraction.rb', line 103 def self.values_map(model_node) ser_model_node = LightModels::Serialization.jsonize_obj(model_node) LightModels::QuerySerialized.collect_values_with_count(ser_model_node) end |