Closed rettinghaus closed 3 months ago
Just ran into this as well.
@aweakley there is an easy fix for UncertainOrApproximate
and Unspecified
, but want to check on the intended behavior. Right now we have three different properties - is_uncertain
, is_approximate
, and is_approximate_and_uncertain
. is_uncertain
and is_approximate
are False
if is_approximate_and_uncertain
is True
- we're treating these as mutually exclusive. Does that make sense?
After setting the properties in UncertainOrApproximate
and Unspecified
based on ua
:
>>> from edtf import parse_edtf, text_to_edtf
>>> e = parse_edtf("1666%")
>>> e.is_uncertain
False
>>> e.is_approximate
False
>>> e.is_uncertain_and_approximate
True
>>> f = parse_edtf("1666~")
>>> f.is_approximate
True
For PartialUncertainOrApproximate
, we have uncertainty/approximation at sublevels, but not currently at top level properties:
>>> parse_edtf("2004-06~-11")
PartialUncertainOrApproximate: '2004-06~-11'
>>> e = parse_edtf("2004-06~-11")
>>> e.is_approximate
False
>>> e.year_month_ua
UA: '~'
>>> e.year_ua
False
I think it makes sense to have is_approximate
, is_uncertain
, and is_uncertain_and_approximate
available here too. The question is whether those resolve to True
if any part of the date is approximate / uncertain? I think they must, because otherwise fully qualified (qualification on the far right) would just parse as L1 UncertainOrApproximate
.
Any thoughts on this one @aweakley ?
Sorry. Yes I agree, I think if any part of the date is approximate or uncertain then the appropriate one should resolve to True
.
we're treating these as mutually exclusive. Does that make sense?
I think it does, because each alternative has different implications for our output.
Great. Should Intervals also have these properties? Right now they do (since they inherit from EDTFObject
) but they are not useful as they don't return actual results (just False
):
>>> from edtf import parse_edtf
>>> e = parse_edtf("2004-06-~01/2004-06-~20")
>>> e
Level2Interval: '2004-06-~01/2004-06-~20'
>>> e.is_approximate
False
>>> e.is_uncertain
False
>>> e.is_uncertain_and_approximate
False
>>> f = parse_edtf("1984~/2004-06")
>>> f
Level1Interval: '1984~/2004-06'
>>> f.is_approximate
False
>>> f.is_uncertain_and_approximate
False
>>> f.is_uncertain
False
I think we should probably set those properties based on whether either of the interval sections has .is_approximate
, etc?
This is resolved in #56
for a date of classes
UncertainOrApproximate
andPartialUncertainOrApproximate
return'false'
onis_approximate
andis_uncertain
. I guess that this is a bug, but couldn't find documentation on that.