Skip to content

Commit

Permalink
Merge branch 'development' into amydev
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyOlex committed Aug 1, 2018
2 parents eca416d + 4e8e0a9 commit 6fa2069
Show file tree
Hide file tree
Showing 19 changed files with 286 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Chrono/TimePhraseToChrono/DayOfWeek.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def buildDayOfWeek(s, chrono_id, chrono_list):
chrono_list.append(my_entity)
chrono_id = chrono_id + 1
# check here to see if it has a modifier
hasMod, mod_type, mod_start, mod_end = Chrono.TimePhraseToChrono.Modifier.hasModifier(s)
hasMod, mod_type, mod_start, mod_end = Chrono.TimePhraseToChrono.Modifier.hasNextLastThis(s)
if (hasMod):
if mod_type == "This":
chrono_list.append(chrono.ChronoThisOperator(entityID=str(chrono_id) + "entity", start_span=abs_Sspan,
Expand Down
2 changes: 1 addition & 1 deletion Chrono/TimePhraseToChrono/Modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def hasModifierText(tpentity):
# @author Amy Olex
# @param tpentity The TimePhrase entity object being parsed
# @return Outputs 4 values: Boolean Flag, Value text, start index, end index
def hasModifier(tpentity):
def hasNextLastThis(tpentity):
# convert to all lower
text_lower = tpentity.getText().lower()
# remove all punctuation
Expand Down
6 changes: 3 additions & 3 deletions Chrono/TimePhraseToChrono/PeriodInterval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import string
import numpy as np
from Chrono import chronoEntities as chrono, utils
from Chrono.TimePhraseToChrono.Modifier import hasModifier
from Chrono.TimePhraseToChrono.Modifier import hasNextLastThis
from Chrono.utils import calculateSpan
from chronoML import ChronoKeras

Expand Down Expand Up @@ -86,7 +86,7 @@ def buildPeriodInterval(s, chrono_id, chrono_list, ref_list, classifier, feats):

else:
# check for a Last Word
hasMod, mod_type, mod_start, mod_end = hasModifier(s)
hasMod, mod_type, mod_start, mod_end = hasNextLastThis(s)

if(hasMod):
if mod_type == "Next":
Expand Down Expand Up @@ -115,7 +115,7 @@ def buildPeriodInterval(s, chrono_id, chrono_list, ref_list, classifier, feats):
chrono_list.append(chrono_this_entity)
else:
# check for a Last Word
hasMod, mod_type, mod_start, mod_end = hasModifier(s)
hasMod, mod_type, mod_start, mod_end = hasNextLastThis(s)
if(hasMod):
if mod_type == "Next":
chrono_list.append(chrono.ChronoNextOperator(entityID=str(chrono_id) + "entity", start_span=ref_Sspan+mod_start, end_span=ref_Sspan+mod_end, repeating_interval=my_entity.get_id()))
Expand Down
4 changes: 2 additions & 2 deletions Chrono/TimePhraseToChrono/Season.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import string
from Chrono import chronoEntities as chrono, utils
from Chrono.TimePhraseToChrono.Modifier import hasModifier
from Chrono.TimePhraseToChrono.Modifier import hasNextLastThis
from Chrono.utils import calculateSpan


Expand All @@ -22,7 +22,7 @@ def buildSeasonOfYear(s, chrono_id, chrono_list, ref_list):
chrono_id = chrono_id + 1

#check here to see if it has a modifier
hasMod, mod_type, mod_start, mod_end = hasModifier(s)
hasMod, mod_type, mod_start, mod_end = hasNextLastThis(s)
if(hasMod):
if mod_type == "This":
chrono_list.append(chrono.ChronoThisOperator(entityID=str(chrono_id) + "entity", start_span=abs_Sspan, end_span=abs_Espan, repeating_interval=my_entity.get_id()))
Expand Down
4 changes: 2 additions & 2 deletions Chrono/TimePhraseToChrono/TextMonthAndDay.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import string
from nltk import WhitespaceTokenizer
from Chrono import chronoEntities as chrono, utils
from Chrono.TimePhraseToChrono.Modifier import hasModifier
from Chrono.TimePhraseToChrono.Modifier import hasNextLastThis
from Chrono.utils import calculateSpan


Expand Down Expand Up @@ -125,7 +125,7 @@ def buildTextMonthAndDay(s, chrono_id, chrono_list, flags, dct=None, ref_list=No
## if the start of the month is not 0 then we have leading text to parse
if(idxstart > 0):
#substr = s.getText()[:idxstart].strip(",.").strip()
hasMod, mod_type, mod_start, mod_end = hasModifier(s)
hasMod, mod_type, mod_start, mod_end = hasNextLastThis(s)
if(hasMod):
if mod_type == "This":
chrono_list.append(chrono.ChronoThisOperator(entityID=str(chrono_id) + "entity", start_span=ref_Sspan+mod_start, end_span=ref_Sspan+mod_end, repeating_interval=my_month_entity.get_id()))
Expand Down
7 changes: 7 additions & 0 deletions dictionary/AbrDay.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Mon.
Tues.
Wed.
Thurs.
Fri.
Sat.
Sun.
45 changes: 45 additions & 0 deletions dictionary/AbrMonth.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Jan.
Feb.
Mar.
Apr.
Jun.
Jul.
Aug.
Sept.
Oct.
Nov.
Dec.
jan.
feb.
mar.
apr.
jun.
jul.
aug.
sept.
oct.
nov.
dec.
Jan
Feb
Mar
Apr
Jun
Jul
Aug
Sept
Oct
Nov
Dec
jan
feb
mar
apr
jun
jul
aug
sept
oct
nov
dec

2 changes: 2 additions & 0 deletions dictionary/After.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
after
later
6 changes: 6 additions & 0 deletions dictionary/Before.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
before
ago
pre
previously
earlier
until
7 changes: 7 additions & 0 deletions dictionary/FullDay.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
24 changes: 24 additions & 0 deletions dictionary/FullMonth.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
January
February
March
April
May
June
July
August
September
October
November
December
january
february
march
april
may
june
july
august
september
october
november
december
14 changes: 14 additions & 0 deletions dictionary/Last.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
last
previously
pre
later
earlier
early
previous
past
lately
final
latest
prior
recent
recently
11 changes: 11 additions & 0 deletions dictionary/Modifier.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
nearly
almost
<
late
mid
fiscal
fy
over
early
approximately
beginning
16 changes: 16 additions & 0 deletions dictionary/PartOfDay.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
morning
evening
afternoon
night
dawn
dusk
tonight
overnight
nights
mornings
evening
afternoons
noon
bedtime
midnight
eve
56 changes: 56 additions & 0 deletions dictionary/Period-Interval.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
decades
decade
yesterday
yesterdays
today
todays
tomorrow
tomorrows
day
week
month
year
daily
weekly
monthly
yearly
century
minute
second
hour
hourly
days
weeks
months
years
centuries
century
minutes
seconds
hours
time
shortly













soon
briefly
awhile
future
lately
annual
hr
hrs
min
mins
quarter
56 changes: 56 additions & 0 deletions dictionary/Period.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
decades
decade
yesterday
yesterdays
today
todays
tomorrow
tomorrows
day
week
month
year
daily
weekly
monthly
yearly
century
minute
second
hour
hourly
days
weeks
months
years
centuries
century
minutes
seconds
hours
time
shortly













soon
briefly
awhile
future
lately
annual
hr
hrs
min
mins
quarter
8 changes: 8 additions & 0 deletions dictionary/Season.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
summer
winter
fall
spring
summers
falls
winters
springs
19 changes: 19 additions & 0 deletions dictionary/TimeZone3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
AST
EST
EDT
CST
CDT
MST
MDT
PST
PDT
HST
SST
SDT
GMT
UTC
BST
CET
IST
MSD
MSK
6 changes: 6 additions & 0 deletions dictionary/TimeZone4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AKST
HAST
HADT
CHST
CEST
EEST

0 comments on commit 6fa2069

Please sign in to comment.