Class: Kotoshu::Languages::Persian
- Inherits:
-
Kotoshu::Language::Base
- Object
- Kotoshu::Language::Base
- Kotoshu::Languages::Persian
- Defined in:
- lib/kotoshu/languages/fa/language.rb
Overview
Persian (Farsi) language implementation.
Registers the Persian language with Kotoshu::Language::Registry under
the fa and fa-IR codes. Uses the
Kotoshu::Language::Normalizer::Persian normalizer (Arabic normalization
plus Arabic→Persian letter canonicalization).
Defined Under Namespace
Classes: Tokenizer
Instance Attribute Summary
Attributes inherited from Kotoshu::Language::Base
#code, #name, #region, #variant
Instance Method Summary collapse
- #default_dictionary_paths ⇒ Object
- #description ⇒ Object
- #dictionary_class ⇒ Object
-
#initialize(code: "fa", name: "Persian", variant: nil) ⇒ Persian
constructor
A new instance of Persian.
- #normalizer ⇒ Object
- #rtl? ⇒ Boolean
- #script_type ⇒ Object
- #tokenizer ⇒ Object
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: "fa", name: "Persian", variant: nil) ⇒ Persian
Returns a new instance of Persian.
20 21 22 |
# File 'lib/kotoshu/languages/fa/language.rb', line 20 def initialize(code: "fa", name: "Persian", variant: nil) super end |
Instance Method Details
#default_dictionary_paths ⇒ Object
40 41 42 |
# File 'lib/kotoshu/languages/fa/language.rb', line 40 def default_dictionary_paths ["/usr/share/dict/persian"] end |
#description ⇒ Object
24 25 26 |
# File 'lib/kotoshu/languages/fa/language.rb', line 24 def description name end |
#dictionary_class ⇒ Object
36 37 38 |
# File 'lib/kotoshu/languages/fa/language.rb', line 36 def dictionary_class Dictionary::Custom end |
#normalizer ⇒ Object
32 33 34 |
# File 'lib/kotoshu/languages/fa/language.rb', line 32 def normalizer @normalizer ||= Language::Normalizer::Persian.new end |
#rtl? ⇒ Boolean
48 49 50 |
# File 'lib/kotoshu/languages/fa/language.rb', line 48 def rtl? true end |
#script_type ⇒ Object
44 45 46 |
# File 'lib/kotoshu/languages/fa/language.rb', line 44 def script_type :arabic end |