Class: CharDet::EscCharSetProber
Instance Attribute Summary
#active
Instance Method Summary
collapse
#filter_high_bit_only, #filter_with_english_letters, #filter_without_english_letters, #get_state
Constructor Details
Returns a new instance of EscCharSetProber.
Instance Method Details
#feed(aBuf) ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/rchardet/escprober.rb', line 65
def feed(aBuf)
aBuf.each_byte do |b|
c = b.chr
for codingSM in @codingSM
next unless codingSM
next unless codingSM.active
codingState = codingSM.next_state(c)
if codingState == EError
codingSM.active = false
@activeSM -= 1
if @activeSM <= 0
@state = ENotMe
return get_state()
end
elsif codingState == EItsMe
@state = EFoundIt
@detectedCharset = codingSM.get_coding_state_machine()
return get_state()
end
end
end
return get_state()
end
|
#get_charset_name ⇒ Object
53
54
55
|
# File 'lib/rchardet/escprober.rb', line 53
def get_charset_name
return @detectedCharset
end
|
#get_confidence ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/rchardet/escprober.rb', line 57
def get_confidence
if @detectedCharset
return 0.99
else
return 0.00
end
end
|
#reset ⇒ Object
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/rchardet/escprober.rb', line 42
def reset
super()
for codingSM in @codingSM
next if !codingSM
codingSM.active = true
codingSM.reset()
end
@activeSM = @codingSM.length
@detectedCharset = nil
end
|