lib/opener/opinion_detector_basic/legacy_processor.rb
##
# Ignore conjunctions when applying strength.
#
Ignore conjunctions when applying strength.
Ignore conjunctions when applying strength .
def apply_conjunctions
        terms_count = terms.count
        i = 0
        while i < terms_count
          if terms[i].use && terms[i].accumulated_strength != 0
            used     = [i]
            list_ids = terms[i].list_ids
            strength = terms[i].accumulated_strength
            terms[i].use = false
            j = i+1
            while true
              if j >= terms_count
                break
              end
              if terms[j].is_conjunction
                terms[j].use = false
                j += 1
              elsif terms[j].use && terms[j].accumulated_strength != 0
                list_ids += terms[j].list_ids
                used << j
                terms[j].use = false
                strength += terms[j].accumulated_strength
                j += 1
              else
                break
              end
            end
            last_used = used.last
            terms[last_used].accumulated_strength = strength
            terms[last_used].list_ids = list_ids
            terms[last_used].use = true
            i = j
          end
          i += 1
        end
      end
def apply_conjunctions terms_count = terms . count i = 0 while i < terms_count if terms [ i ] . use && terms [ i ] . accumulated_strength != 0 used = [ i ] list_ids = terms [ i ] . list_ids strength = terms [ i ] . accumulated_strength terms [ i ] . use = false j = i + 1 while true if j >= terms_count break end if terms [ j ] . is_conjunction terms [ j ] . use = false j += 1 elsif terms [ j ] . use && terms [ j ] . accumulated_strength != 0 list_ids += terms [ j ] . list_ids used << j terms [ j ] . use = false strength += terms [ j ] . accumulated_strength j += 1 else break end end last_used = used . last terms [ last_used ] . accumulated_strength = strength terms [ last_used ] . list_ids = list_ids terms [ last_used ] . use = true i = j end i += 1 end end
Ignore conjunctions when applying strength.
Ignore conjunctions when applying strength .