Sha256: 41f2e40166f6b9348566c6b46e676c9043f9718fd604a7c73570f30de2085595
Contents?: true
Size: 805 Bytes
Versions: 13
Compression:
Stored size: 805 Bytes
Contents
require 'singleton' import 'org.vicomtech.opennlp.LanguageDetection.CybozuDetector' module Opener class LanguageIdentifier class Detector attr_reader :options include Singleton def initialize(options={}) @options = options @detector = CybozuDetector.new(profiles_path) @semaphore = Mutex.new end def detect(input) @semaphore.synchronize do @detector.detect(input) end end def probabilities(input) @semaphore.synchronize do result = @detector.detect_langs(input) end end def profiles_path default_path = File.expand_path("../../../../core/target/classes/profiles", __FILE__) options.fetch(:profiles_path, default_path) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems