Sha256: d6c2c9abe383eb136d6361fb0949766f8300c4b4b83ae4ee138ba47063c2d5ec

Contents?: true

Size: 543 Bytes

Versions: 3

Compression:

Stored size: 543 Bytes

Contents

module Langusta
  class LanguageDetectionFacade
    def initialize
      @factory = DetectorFactory.new
      profiles = load_profiles()
      profiles.each do |profile|
        @factory.add_profile(profile)
      end
    end

    def detect(utf8_string)
      detector = @factory.create()
      detector.append(Langusta.utf82cp(utf8_string))
      detector.detect()
    end

    private
    def load_profiles
      Dir[File.join(PROFILES_PATH, '/*')].map do |filename|
        LangProfile.load_from_file(filename)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
langusta-0.2.4 lib/langusta/language_detection_facade.rb
langusta-0.2.3 lib/langusta/language_detection_facade.rb
langusta-0.2.2 lib/langusta/language_detection_facade.rb