Class: Kotoshu::Languages::Hebrew

Inherits:
Kotoshu::Language::Base show all
Defined in:
lib/kotoshu/languages/he/language.rb

Overview

Hebrew language implementation.

Registers the Hebrew language with Kotoshu::Language::Registry under the he and he-IL codes. Uses the Kotoshu::Language::Normalizer::Hebrew normalizer (NFC + niqqud stripping + dagesh removal + maqaf normalization) so that bare dictionary forms match against user input that may include vowel points.

Examples:

lang = Kotoshu::Languages::Hebrew.new
lang.script_type  # => :hebrew
lang.rtl?         # => true

Defined Under Namespace

Classes: Tokenizer

Instance Attribute Summary

Attributes inherited from Kotoshu::Language::Base

#code, #name, #region, #variant

Instance Method Summary collapse

Methods inherited from Kotoshu::Language::Base

#base_code, #base_language?, #compatible_with?, #encoding, #full_name, #info, instance, #matches_code?, #normalize, #normalize_word, #region_code, register, registered_codes, #tokenize, #valid_word?

Constructor Details

#initialize(code: "he", name: "Hebrew", variant: nil) ⇒ Hebrew

Returns a new instance of Hebrew.



21
22
23
# File 'lib/kotoshu/languages/he/language.rb', line 21

def initialize(code: "he", name: "Hebrew", variant: nil)
  super
end

Instance Method Details

#default_dictionary_pathsObject



41
42
43
# File 'lib/kotoshu/languages/he/language.rb', line 41

def default_dictionary_paths
  ["/usr/share/dict/hebrew"]
end

#descriptionObject



25
26
27
# File 'lib/kotoshu/languages/he/language.rb', line 25

def description
  name
end

#dictionary_classObject



37
38
39
# File 'lib/kotoshu/languages/he/language.rb', line 37

def dictionary_class
  Dictionary::Custom
end

#normalizerObject



33
34
35
# File 'lib/kotoshu/languages/he/language.rb', line 33

def normalizer
  @normalizer ||= Language::Normalizer::Hebrew.new
end

#rtl?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/kotoshu/languages/he/language.rb', line 49

def rtl?
  true
end

#script_typeObject



45
46
47
# File 'lib/kotoshu/languages/he/language.rb', line 45

def script_type
  :hebrew
end

#tokenizerObject



29
30
31
# File 'lib/kotoshu/languages/he/language.rb', line 29

def tokenizer
  @tokenizer ||= Tokenizer.new
end