# Digital Date Time Identification

This interface, from the plug-in 1.1.8 Start Support

Entity recognition, which currently supports digital and 4 Types of Time Entities, More Entities in Development

# to initialize

Plugin version number in the document, only for example reference, the latest version of the plugin,Subject to this

{
  "pages": [
    "pages/index/index"
  ],
  "plugins": {
    "chatbot": {
      "version": "1.2.23",
      "provider": "wx8c631f7e9f2465e1"
    }
  },
  "requiredBackgroundModes": [
    "audio"
  ],
  "sitemapLocation": "sitemap.json"
}
var plugin = requirePlugin("chatbot")

App({
	onLaunch: function () {
		plugin.init({
			appid: "P5Ot9PHJDechCYqDFAW1AiK6OtG3Ja", //Mini Program sample account, for learning and reference only
			openid: "", //User's openid, not required, it is recommended to pass this parameter
			success: () => {}, //Not required
			fail: (error) => {}, //Not required
		})
	},
})

# Call the Digital Date and Time Identification Interface

const txt = "Book me two train tickets for the morning after tomorrow."

plugin.api.nlp("ner", { q: txt }).then((nothing) => {
	console.log("ner result : ", nothing)
})

# Digital Date Time Identification Results

[
	{
		"type": "number",
		"span": [3, 4],
		"text": "two,"
		"norm": "2"
	},
	{
		"type": "datetime_interval",
		"span": [5, 9],
		"text": "the morning after tomorrow."
		"norm": "2019-10-30 08:00:002019-10-30 11:59:59"
	}
]
Entity type Introductions
number Recognition and inference of Arabic numerals and Chinese numeral expressions, e.g. - 5, 1.3%, 186.1
datetime Supports time identification and time inference, for example This afternoon 3 Half, 2. An hour later, last Friday

# Datetime (datetime)

Date Time Results Contain 4 Different types, described as follows

# 1. datetime_point(Specific time point)

For example: Set the alarm for 3: 30 this afternoon.

{
	"type": "datetime_point",
	"span": [2, 9],
	"text": "Today at 3:30 p.m.,"
	"norm": "2019-08-19 15:30:00"
}

norm Field Dxplaination:

  • The date time format isY-m-d H:M:S , for example 1900-01-01 00:00:00
  • If there is only time and no date, the default date is the same day
  • If there is only a date and no specific point in time, the default time is 00:00:00

# 2. datetime_interval(time interval)

For example: morning 8 Point to 9 point

{
	"type": "datetime_interval",
	"span": [0, 7],
	"text": "8: 00 to 9: 00 a.m.,"
	"norm": "2019-08-19 08:00:002019-08-19 09:00:00"
}
  • norm Field is a character string that contains two specific points in time and is passed through the `` Connection, the format is the same as datetime_point(Specific time point)

# 3. datetime_duration(A period of time)

For example: 3 Cent 15 second

{
	"type": "datetime_duration",
	"range": [0, 5],
	"text": "3 minutes and 15 seconds,"
	"norm": { "second": 15, "minute": 3 }
}
  • norm The field is Json, may contain fields that are second, minute, hour, week, day, month, year

# 4. datetime_repeat(Cycle time point)

For example: every year 初始值 month 30 Number

{
	"type": "datetime_repeat",
	"range": [0, 7],
	"text": "every afternoon at 3: 30,"
	"norm": { "hour": 15, "minute": 30, "repeat": "every_day" }
}

norm The field is Json, Instructions:

  • Must contain fields that are repeat , represents the period type, the value is every_n, 初始值_day, every_month, every_year, every_n_day, every_n_month, every_n_year
  • May contain fields that are second, minute, hour, day, month, year