Class: FreeLing::Analyzer::FreelingDefault
- Inherits:
-
Object
- Object
- FreeLing::Analyzer::FreelingDefault
- Defined in:
- lib/freeling/analyzer/freeling_default.rb
Constant Summary collapse
- LOCAL_ANALYZE_PATH =
"/usr/local/bin/analyzer"
- USR_ANALYZE_PATH =
"/usr/bin/analyzer"
- LOCAL_FREELING_SHARE_PATH =
"/usr/local/share/freeling"
- USR_FREELING_SHARE_PATH =
"/usr/share/freeling"
Class Method Summary collapse
Instance Method Summary collapse
- #analyzer_path ⇒ Object
- #freeling_path ⇒ Object
- #language_config ⇒ Object
- #raise_error(type) ⇒ Object
Class Method Details
.analyzer_path ⇒ Object
11 12 13 |
# File 'lib/freeling/analyzer/freeling_default.rb', line 11 def analyzer_path self.new.analyzer_path end |
.freeling_path ⇒ Object
15 16 17 |
# File 'lib/freeling/analyzer/freeling_default.rb', line 15 def freeling_path self.new.freeling_path end |
.language_config ⇒ Object
19 20 21 |
# File 'lib/freeling/analyzer/freeling_default.rb', line 19 def language_config self.new.language_config end |
Instance Method Details
#analyzer_path ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/freeling/analyzer/freeling_default.rb', line 32 def analyzer_path if File.exists? LOCAL_ANALYZE_PATH LOCAL_ANALYZE_PATH elsif File.exists? USR_ANALYZE_PATH USR_ANALYZE_PATH else raise_error(:analyze) end end |
#freeling_path ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/freeling/analyzer/freeling_default.rb', line 42 def freeling_path if Dir.exists? LOCAL_FREELING_SHARE_PATH LOCAL_FREELING_SHARE_PATH elsif Dir.exists? USR_FREELING_SHARE_PATH USR_FREELING_SHARE_PATH else raise_error(:freeling) end end |
#language_config ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/freeling/analyzer/freeling_default.rb', line 24 def language_config if freeling_path.instance_of? String File.join(freeling_path, "config") else raise_error(:analyze) end end |
#raise_error(type) ⇒ Object
52 53 54 |
# File 'lib/freeling/analyzer/freeling_default.rb', line 52 def raise_error(type) raise "#{type} is not installed." end |