Skip to content

Commit

Permalink
Heuristic: when only one border known set other to ±½a
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Sep 22, 2018
1 parent 4741dc4 commit a47cadf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datings.py
Expand Up @@ -15,6 +15,7 @@

logger = logging.getLogger(__name__)

HALF_INTERVAL_CORRECTION = datetime.timedelta(365/2)

def parse_datestr(datestr: str) -> datetime.date:
if datestr is None:
Expand Down Expand Up @@ -188,8 +189,13 @@ def add_to_graph(self, G: nx.MultiDiGraph):
for source in self.sources:
if self.start is not None:
G.add_edge(self.date_before, item, kind=self.start_attr[0], source=source, dating=self, xml=self.xmlsource)
if self.end is None:
G.add_edge(item, self.date_before + HALF_INTERVAL_CORRECTION, kind='not_after', source=BiblSource('faust://heuristic'), xml=self.xmlsource)
if self.end is not None:
G.add_edge(item, self.date_after, kind=self.end_attr[0], source=source, dating=self, xml=self.xmlsource)
if self.start is None:
G.add_edge(self.date_after - HALF_INTERVAL_CORRECTION, item, kind='not_before', source=BiblSource('faust://heuristic'), xml=self.xmlsource)



class RelativeDating(_AbstractDating):
Expand Down

0 comments on commit a47cadf

Please sign in to comment.