Class: TxNlp::Text
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #indent_result ⇒ Object
-
#initialize(text, action_type = 'SimilarWords') ⇒ Text
constructor
A new instance of Text.
- #raw_result ⇒ Object
Methods inherited from Base
#encode_parameters, #fixed_paramaters, #full_request_url, #json, #orginal_parameters, #region, #request_object, #request_params, #secret_id, #secret_key, #signature, #string_for_sign, #to_params, #url
Constructor Details
#initialize(text, action_type = 'SimilarWords') ⇒ Text
Returns a new instance of Text.
5 6 7 8 9 |
# File 'lib/tx_nlp/text.rb', line 5 def initialize(text, action_type = 'SimilarWords') @action_type = action_type @encode_text = text.tr("\n", ' ') @escape_text = CGI.escape(@encode_text) end |
Instance Method Details
#indent_result ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/tx_nlp/text.rb', line 19 def indent_result if json['Response']['Error'] json else new_content = raw_result.join(',') new_content end end |
#raw_result ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/tx_nlp/text.rb', line 11 def raw_result if json['Response']['Error'] json else original_data = json['Response']["SimilarWords"] end end |