Skip to content

Commit

Permalink
Fix extracting slots from dates (#819)
Browse files Browse the repository at this point in the history
Avoid normalizing dates because the result will depend on the
current time.
  • Loading branch information
gcampax committed Oct 22, 2021
1 parent 4c1f15a commit c2d322e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/dataset-tools/evaluation/slot_extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,14 @@ export default class SlotExtractor {

if (value instanceof Ast.DateValue) {
const date = value.value;
if (date instanceof Ast.DateEdge)
if (date === null)
return 'now';
else if (date instanceof Ast.DateEdge)
return date.edge + ' ' + date.unit;
else if (date instanceof Ast.WeekDayDate)
return date.weekday;
else if (date instanceof Ast.DatePiece)
return `${date.year}/${date.month}/${date.day}`;
}

if (value instanceof Ast.EventValue) {
Expand Down

0 comments on commit c2d322e

Please sign in to comment.