timexAttributes = temporal.getTimexAttributes(timeIndex); if (options.includeRange) { SUTime.Temporal rangeTemporal = temporal.getRange(); if (rangeTemporal != null) { timexAttributes.put("range", rangeTemporal.toString());
public Map<String, String> getTimexAttributes(TimeIndex timeIndex) { Map<String, String> map = new LinkedHashMap<>(); map.put(TimexAttr.tid.name(), getTidString(timeIndex)); // NOTE: GUTime used "VAL" instead of TIMEX3 standard "value" // NOTE: attributes are case sensitive, GUTIME used mostly upper case // attributes.... String val = getTimexValue(); if (val != null) { map.put(TimexAttr.value.name(), val); } if (val == null || includeTimexAltValue()) { String str = toFormattedString(FORMAT_FULL); if (str != null) { map.put("alt_value", str); } } /* Range r = getRange(); if (r != null) map.put("range", r.toString()); */ /* map.put("str", toString()); */ map.put(TimexAttr.type.name(), getTimexType().name()); if (mod != null) { map.put(TimexAttr.mod.name(), mod); } return map; }
timexAttributes = temporal.getTimexAttributes(timeIndex); if (options.includeRange) { SUTime.Temporal rangeTemporal = temporal.getRange(); if (rangeTemporal != null) { timexAttributes.put("range", rangeTemporal.toString());
timexAttributes = temporal.getTimexAttributes(timeIndex); if (options.includeRange) { SUTime.Temporal rangeTemporal = temporal.getRange(); if (rangeTemporal != null) { timexAttributes.put("range", rangeTemporal.toString());
Map<String,String> timexAttributes = temporal.getTimexAttributes(timeIndex); if (options.includeRange) { SUTime.Temporal rangeTemporal = temporal.getRange(); if (rangeTemporal != null) { timexAttributes.put("range", rangeTemporal.toString());
t = t.addModApprox(mod, approx); return t; } else { t = t.addModApprox(mod, approx); if (!this.equals(t)) { return t.resolve(refTime, flags); } else { return (groundedBase != null) ? groundedBase.addModApprox(mod, approx) : null;
t = t.addModApprox(mod, approx); return t; } else { t = t.addModApprox(mod, approx); if (!this.equals(t)) { return t.resolve(refTime, flags); } else { return (groundedBase != null) ? groundedBase.addModApprox(mod, approx) : null;
t = t.addModApprox(mod, approx); return t; } else { t = t.addModApprox(mod, approx); if (!this.equals(t)) { return t.resolve(refTime, flags); } else { return (groundedBase != null) ? groundedBase.addModApprox(mod, approx) : null;
protected SUTime.Temporal addMod(String expression, SUTime.Temporal temporal) { // Add MOD\ if (expression.matches("(?i).*\\b(late|end)\\b.*")) { // NOTE: TIMEX3 standard has END, not LATE return temporal.addMod(SUTime.TimexMod.LATE.name()); } else if (expression.matches("(?i).*\\bno\\s+more\\s+than\\b.*") || expression.matches("(?i).*\\bup\\s+to\\b.*")) { return temporal.addMod(SUTime.TimexMod.EQUAL_OR_LESS.name()); } else if (expression.matches("(?i).*\\bmore\\s+than\\b.*")) { return temporal.addMod(SUTime.TimexMod.MORE_THAN.name()); } else if (expression.matches("(?i).*\\bno\\s+less\\s+than\\b.*")) { return temporal.addMod(SUTime.TimexMod.EQUAL_OR_MORE.name()); } else if (expression.matches("(?i).*\\bless\\s+than\\b.*")) { return temporal.addMod(SUTime.TimexMod.LESS_THAN.name()); } else if (expression.matches("(?i).*\\b(early|start|beginning|dawn\\s+of)\\b.*")) { // NOTE: TIMEX3 standard has START, not EARLY return temporal.addMod(SUTime.TimexMod.EARLY.name()); } else if (expression.matches("(?i).*\\bmid(dle)?\\b.*")) { return temporal.addMod(SUTime.TimexMod.MID.name()); } else if (expression.matches("(?i).*\\bat\\s+least\\b.*")) { return temporal.addMod(SUTime.TimexMod.EQUAL_OR_MORE.name()); } else if (expression.matches("(?i).*\\b(about|around|some)\\b.*")) { // In GUTIME, this was extra MOD attribute but XML standard doesn't really allow for multiple attributes with same name... return temporal.addMod(SUTime.TimexMod.APPROX.name()); } return temporal; }
public Time resolve(Time refTime, int flags) { CompositePartialTime cpt = makeComposite(new PartialTime(this, new Partial()), this); if (cpt != null) { return cpt.resolve(refTime, flags); } Time groundedBase = null; if (base == TIME_REF) { groundedBase = refTime; } else if (base != null) { groundedBase = base.resolve(refTime, flags).getTime(); } Range groundedRange = null; if (range != null) { groundedRange = range.resolve(refTime, flags).getRange(); } /* if (groundedRange == range && groundedBase == base) { return this; } */ final TimeLabel tl = getTimeLabel(); InexactTime t = new InexactTime(groundedBase, duration, groundedRange) { public TimeLabel getTimeLabel() { return tl; } }; t.mod = mod; return t; }
private SUTime.Temporal makeSet(SUTime.Temporal t, String freq) { if (freq == null) return t; // Make into set String quant = null; int scale = 1; SUTime.Duration p = t.getPeriod(); if (freq != null) { freq = freq.toLowerCase(); if (freq.equals("alternate") || freq.contains("other")) { quant = freq; scale = 2; } else if (freq.equals("each") || freq.equals("every")) { quant = freq; } else if (freq.startsWith("every")) { quant = freq; Number n = NumberNormalizer.wordToNumber(quant.substring(6)); if (n != null) { scale = n.intValue(); } } } if (p != null & scale != 1) { p = p.multiplyBy(scale); } return new SUTime.PeriodicTemporalSet(t,p,quant,null/*"P1X"*/); }
public Map<String, String> getTimexAttributes(TimeIndex timeIndex) { Map<String, String> map = new LinkedHashMap<String, String>(); map.put(TimexAttr.tid.name(), getTidString(timeIndex)); // NOTE: GUTime used "VAL" instead of TIMEX3 standard "value" // NOTE: attributes are case sensitive, GUTIME used mostly upper case // attributes.... String val = getTimexValue(); if (val != null) { map.put(TimexAttr.value.name(), val); } if (val == null || includeTimexAltValue()) { String str = toFormattedString(FORMAT_FULL); if (str != null) { map.put("alt_value", str); } } /* Range r = getRange(); if (r != null) map.put("range", r.toString()); */ /* map.put("str", toString()); */ map.put(TimexAttr.type.name(), getTimexType().name()); if (mod != null) { map.put(TimexAttr.mod.name(), mod); } return map; }
public Map<String, String> getTimexAttributes(TimeIndex timeIndex) { Map<String, String> map = new LinkedHashMap<String, String>(); map.put(TimexAttr.tid.name(), getTidString(timeIndex)); // NOTE: GUTime used "VAL" instead of TIMEX3 standard "value" // NOTE: attributes are case sensitive, GUTIME used mostly upper case // attributes.... String val = getTimexValue(); if (val != null) { map.put(TimexAttr.value.name(), val); } if (val == null || includeTimexAltValue()) { String str = toFormattedString(FORMAT_FULL); if (str != null) { map.put("alt_value", str); } } /* Range r = getRange(); if (r != null) map.put("range", r.toString()); */ /* map.put("str", toString()); */ map.put(TimexAttr.type.name(), getTimexType().name()); if (mod != null) { map.put(TimexAttr.mod.name(), mod); } return map; }
public Map<String, String> getTimexAttributes(TimeIndex timeIndex) { Map<String, String> map = new LinkedHashMap<>(); map.put(TimexAttr.tid.name(), getTidString(timeIndex)); // NOTE: GUTime used "VAL" instead of TIMEX3 standard "value" // NOTE: attributes are case sensitive, GUTIME used mostly upper case // attributes.... String val = getTimexValue(); if (val != null) { map.put(TimexAttr.value.name(), val); } if (val == null || includeTimexAltValue()) { String str = toFormattedString(FORMAT_FULL); if (str != null) { map.put("alt_value", str); } } /* Range r = getRange(); if (r != null) map.put("range", r.toString()); */ /* map.put("str", toString()); */ map.put(TimexAttr.type.name(), getTimexType().name()); if (mod != null) { map.put(TimexAttr.mod.name(), mod); } return map; }
public Time resolve(Time refTime, int flags) { CompositePartialTime cpt = makeComposite(new PartialTime(this, new Partial()), this); if (cpt != null) { return cpt.resolve(refTime, flags); } Time groundedBase = null; if (base == TIME_REF) { groundedBase = refTime; } else if (base != null) { groundedBase = base.resolve(refTime, flags).getTime(); } Range groundedRange = null; if (range != null) { groundedRange = range.resolve(refTime, flags).getRange(); } /* if (groundedRange == range && groundedBase == base) { return this; } */ return createTemporal(standardTemporalType, timeLabel, mod, new InexactTime(groundedBase, duration, groundedRange)); //return new InexactTime(groundedBase, duration, groundedRange); }
@Override public Time resolve(Time refTime, int flags) { CompositePartialTime cpt = makeComposite(new PartialTime(this, new Partial()), this); if (cpt != null) { return cpt.resolve(refTime, flags); } Time groundedBase = null; if (base == TIME_REF) { groundedBase = refTime; } else if (base != null) { groundedBase = base.resolve(refTime, flags).getTime(); } Range groundedRange = null; if (range != null) { groundedRange = range.resolve(refTime, flags).getRange(); } /* if (groundedRange == range && groundedBase == base) { return this; } */ return createTemporal(standardTemporalType, timeLabel, mod, new InexactTime(groundedBase, duration, groundedRange)); //return new InexactTime(groundedBase, duration, groundedRange); }
private SUTime.Time findReferenceDate(List<TimeExpression> timeExpressions) { // Find first full date in this annotation with year, month, and day for (TimeExpression te:timeExpressions) { SUTime.Temporal t = te.getTemporal(); if (t instanceof SUTime.Time) { if (t.isGrounded()) { return t.getTime(); } else if (t instanceof SUTime.PartialTime) { if (JodaTimeUtils.hasYYYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime(); } else if (JodaTimeUtils.hasYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime().resolve(SUTime.getCurrentTime()).getTime(); } } } } return null; } }
private static SUTime.Time findReferenceDate(List<TimeExpression> timeExpressions) { // Find first full date in this annotation with year, month, and day for (TimeExpression te:timeExpressions) { SUTime.Temporal t = te.getTemporal(); if (t instanceof SUTime.Time) { if (t.isGrounded()) { return t.getTime(); } else if (t instanceof SUTime.PartialTime) { if (JodaTimeUtils.hasYYYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime(); } else if (JodaTimeUtils.hasYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime().resolve(SUTime.getCurrentTime()).getTime(); } } } } return null; }
public abstract Range getRange(int flags, Duration granularity);
public abstract Range getRange(int flags, Duration granularity);