Class: Langusta::LanguageDetectionFacade

Inherits:
Object
  • Object
show all
Defined in:
lib/langusta/language_detection_facade.rb

Instance Method Summary collapse

Constructor Details

#initializeLanguageDetectionFacade

Returns a new instance of LanguageDetectionFacade.



3
4
5
6
7
8
9
# File 'lib/langusta/language_detection_facade.rb', line 3

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

Instance Method Details

#detect(ucs2_string) ⇒ Object



11
12
13
14
15
# File 'lib/langusta/language_detection_facade.rb', line 11

def detect(ucs2_string)
  detector = @factory.create()
  detector.append(ucs2_string)
  detector.detect()
end