Module: TextDetector

Defined in:
lib/text_detector.rb,
lib/text_detector/version.rb,
lib/text_detector/detector.rb,
lib/text_detector/executor.rb,
lib/text_detector/dictionary.rb,
lib/text_detector/detector/base.rb,
lib/text_detector/detector/regexp.rb,
lib/text_detector/detector/simple.rb,
lib/text_detector/dictionary/base.rb,
lib/text_detector/dictionary/file.rb

Defined Under Namespace

Modules: Detector, Dictionary Classes: Executor

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.factory(type, dictionary) ⇒ Object



6
7
8
# File 'lib/text_detector.rb', line 6

def self.factory(type, dictionary)
  Executor.new type, dictionary
end

.normalize(text) ⇒ Object



14
15
16
# File 'lib/text_detector.rb', line 14

def self.normalize(text)
  NKF.nkf('--katakana -w', shallow_normalize(text))
end

.shallow_normalize(text) ⇒ Object



10
11
12
# File 'lib/text_detector.rb', line 10

def self.shallow_normalize(text)
  text.unicode_normalize(:nfc)
end