instance method
feed
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v2.3.18Signature
feed(aBuf)
No documentation comment.
Parameters
-
aBufreq
Source
# File actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb, line 66
def feed(aBuf)
if not @_mModel['keepEnglishLetter']
aBuf = filter_without_english_letters(aBuf)
end
aLen = aBuf.length
if not aLen
return get_state()
end
aBuf.each_byte do |b|
c = b.chr
order = @_mModel['charToOrderMap'][c[0]]
if order < SYMBOL_CAT_ORDER
@_mTotalChar += 1
end
if order < SAMPLE_SIZE
@_mFreqChar += 1
if @_mLastOrder < SAMPLE_SIZE
@_mTotalSeqs += 1
if not @_mReversed
@_mSeqCounters[@_mModel['precedenceMatrix'][(@_mLastOrder * SAMPLE_SIZE) + order]] += 1
else # reverse the order of the letters in the lookup
@_mSeqCounters[@_mModel['precedenceMatrix'][(order * SAMPLE_SIZE) + @_mLastOrder]] += 1
end
end
end
@_mLastOrder = order
end
if get_state() == EDetecting
if @_mTotalSeqs > SB_ENOUGH_REL_THRESHOLD
cf = get_confidence()
if cf > POSITIVE_SHORTCUT_THRESHOLD
$stderr << "#{@_mModel['charsetName']} confidence = #{cf}, we have a winner\n" if $debug
@_mState = EFoundIt
elsif cf < NEGATIVE_SHORTCUT_THRESHOLD
$stderr << "#{@_mModel['charsetName']} confidence = #{cf}, below negative shortcut threshold #{NEGATIVE_SHORTCUT_THRESHOLD}\n" if $debug
@_mState = ENotMe
end
end
end
return get_state()
end
Defined in actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb line 66
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in CharDet::SingleByteCharSetProber