CoreNLP SUTIME - 季节回归北半球日期

g52tjvyc  于 5个月前  发布在  其他
关注(0)|答案(2)|浏览(53)

你去年冬天去了哪里?
"last winter" 返回 2018-01-12 至 2018-01-03 作为参考日期 2019-05-06。
这对于北半球是正确的,但对于南半球不正确。
有没有办法指定半球?

nhjlsmyf

nhjlsmyf1#

嗨,我们正在为SUTime编写一个教程,并将此作为示例。如果您想要更改半球,您需要修改defs.sutime.txt规则文件以自定义所需的内容,然后修改属性以使用自定义规则文件的sutime.rules = /path/to/defs.custom.sutime.txt,edu/stanford/nlp/models/sutime/english.sutime.txt,edu/stanford/nlp/models/sutime/english.holidays.sutime.txt
您还可以将自定义内容放入自己的规则文件中,并将该文件放置在defs.sutime.txtedu/stanford/nlp/models/sutime/english.sutime.txt之间的逗号分隔的规则文件列表中。在构建SUTime管道时,规则文件将按顺序读取,因此通常情况下,如果将自定义内容放入单独的文件中,它们可以适应不同的规则文件之间。
您需要将这些条目更改为适当的南半球设置:

// Dates are rough with respect to northern hemisphere (actual
  // solstice/equinox days depend on the year)
  SPRING_EQUINOX = {
    type: DAY_OF_YEAR,
	value: InexactTime( TimeRange( IsoDate(ANY, 3, 20), IsoDate(ANY, 3, 21) ) )
  }
  SUMMER_SOLSTICE = {
    type: DAY_OF_YEAR,
	value: InexactTime( TimeRange( IsoDate(ANY, 6, 20), IsoDate(ANY, 6, 21) ) )
  }
  FALL_EQUINOX = {
    type: DAY_OF_YEAR,
	value: InexactTime( TimeRange( IsoDate(ANY, 9, 22), IsoDate(ANY, 9, 23) ) )
  }
  WINTER_SOLSTICE = {
    type: DAY_OF_YEAR,
	value: InexactTime( TimeRange( IsoDate(ANY, 12, 21), IsoDate(ANY, 12, 22) ) )
  }

  // Dates for seasons are rough with respect to northern hemisphere
  SPRING = {
      type: SEASON_OF_YEAR,
      label: "SP",
      value: InexactTime( SPRING_EQUINOX, QUARTER, TimeRange( MARCH, JUNE, QUARTER ) ) }
  SUMMER = {
      type: SEASON_OF_YEAR,
      label: "SU",
      value: InexactTime( SUMMER_SOLSTICE, QUARTER, TimeRange( JUNE, SEPTEMBER, QUARTER ) )
  }
  FALL = {
      type: SEASON_OF_YEAR,
      label: "FA",
      value: InexactTime( FALL_EQUINOX, QUARTER, TimeRange( SEPTEMBER, DECEMBER, QUARTER ) )
  }
  WINTER = {
      type: SEASON_OF_YEAR,
      label: "WI",
      value: InexactTime( WINTER_SOLSTICE, QUARTER, TimeRange( DECEMBER, MARCH, QUARTER ) )
  }
neskvpey

neskvpey2#

在未来的版本中,我们可能会创建与南半球相关的规则文件并进行分发。

相关问题