Class: DucklingService::Response
- Inherits:
-
Object
- Object
- DucklingService::Response
- Defined in:
- src/services/duckling_service.rb
Overview
Describes a duckling response
Instance Method Summary collapse
-
#parses? ⇒ Boolean
Check if there are parses discovered.
-
#single_parse? ⇒ Boolean
Check if there is a single parse.
-
#time ⇒ DucklingService::TimeResponse
The extracted times from all of the parses.
Instance Method Details
#parses? ⇒ Boolean
Check if there are parses discovered
A parse is a substring of the original text that has an extracted meaning.
59 60 61 |
# File 'src/services/duckling_service.rb', line 59 def parses? @parses.size > 0 end |
#single_parse? ⇒ Boolean
Check if there is a single parse
A parse is a substring of the original text that has an extracted meaning.
68 69 70 |
# File 'src/services/duckling_service.rb', line 68 def single_parse? @parses.size == 1 end |
#time ⇒ DucklingService::TimeResponse
The extracted times from all of the parses
75 76 77 78 |
# File 'src/services/duckling_service.rb', line 75 def time # TODO: Can there be multiple time parses? @time ||= TimeResponse.new @parses.find { |parse| parse['dim'] == 'time' } end |