Documentation ¶
Overview ¶
Package datetime has the utilities required for interpreting date/time from a nlp query
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duckling ¶
type Duckling struct {
// contains filtered or unexported fields
}
Duckling is a datetime service
func NewDuckling ¶
NewDuckling returns a duckling service instance. If it couldn't be initialized due to missing env variables - DUCKLING_SERVER holding host address will return an error
type Response ¶
type Response struct { //Start index of the words denoting date-time in the given query Start int `json:"start,omitempty"` //End index of the words denoting date-time in the given query End int `json:"end,omitempty"` //Dim is the dimension of the response. We are intrested only if the Dim is time Dim string `json:"dim,omitempty"` //Value stores the value of the response. Value Value `json:"value,omitempty"` //Body is the string from which date is referred Body string `json:"body,omiempty"` }
Response is the response of the package for external use
type Results ¶
type Results struct { //Res has the list of response Res []Response }
Results has list of responses from the service
type Service ¶
Service interface produces the querying service
func DefaultService ¶
DefaultService will return a service to provide the interpretation of datetime
type TimeValue ¶
type TimeValue struct { //String value of the time Value string `json:"value,omitempty"` //Gran of the time to like hour, day etc described by the text Gran string `json:"gran,omitempty"` //Time stores the time value Time *time.Time `json:"-"` //Error will be set once isvalid is run if parsing failed Error error `json:"-"` }
TimeValue is the Value of the time stored
type Value ¶
type Value struct { //To indicates the to interval To *TimeValue `json:"to,omitempty"` //From indicates the from interval From *TimeValue `json:"from,omitempty"` //Type of value Type string `json:"type,omitempty"` //String value of the time Value string `json:"value,omitempty"` //Gran of the time to like hour, day etc described by the text Gran string `json:"gran,omitempty"` //Time stores the time value Time *time.Time `json:"-"` //Error will be set once isvalid is run if parsing failed Error error `json:"-"` }
Value is the value struct holding the time
Click to show internal directories.
Click to hide internal directories.