DAY 1:
Today I started working on reforming my knowledge base.
For starting with this, I made an assumption for simplicity:
When a person mentions a date range, he will mostly use the same format for both the dates mentioned in the range.
This can be seen from the example above
I have found 7 primary types of date formats which are the most common ones.
Therefore for finding what "type" of the date it is, I have assigned a different value for each type. Based on the date type, I wrote specific functions for each type of date to find out the day,month, and year from both the dates and then I created another function that takes the y,m,d of date1 and date2 and calculates the duration.
The logic I used was something that I came up with and I felt the best way, is finding out the number of days between the 2 dates.
This was the final logic after lots of trials and errors.
By doing this for different types, different functions were created and by creating the debug text files, I observed the date range generated in days. This worked perfectly for different date types.
I faced a problem after this
- How to incorporate "present"
- How to put the information of day month day onto to the Kb?(as this was being done for dates belonging to date range, not generic standalone dates)
DAY 2:
I started today by addressing the problem that I faced yesterday, and that is the incorporation of "present" and putting information onto the knowledge base.
I started with the second element. For this, I went to each and every specific rule and found out how the information of day, month, and year was being handled and accordingly put the normalized information as an attribute on the corresponding node on the tree.
This was done for all the date rules.
DAY 3-5:
I was able to incorporate present. This involved me refactoring a large amount of code. Instead of processing node by node in the function, I started normalizing the date and putting up this information on the Parse tree. Then based on the dates, I created a singular program that takes up information from the normalized dates and calculates the number of days, months and years that has passed between 2 dates. All this information has been put up onto the Knowledge Base
No comments:
Post a Comment