Skip to content

Commit 7f3cc13

Browse files
committed
update notebook
1 parent b82fffc commit 7f3cc13

1 file changed

Lines changed: 22 additions & 27 deletions

File tree

notebooks/lib-usage-notebook.ipynb

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"outputs": [],
1717
"source": [
1818
"S1 = 'Today is 10/12/16 and tomorrow is January 01 2019.'\n",
19-
"S2 = 'entries are due by January 4, 2017 at 8:00pm'\n",
19+
"S2 = 'entries are due by January 04, 2017 at 8:00pm'\n",
2020
"S3 = 'created 01/15/2005 by ACME Inc. and associates.'\n",
2121
"S4 = 'Dec.01.2015 - Dec 31 2015 - Dec,12,2015 - Dec,12,2015 - Dec,12th,2015 - DEC122014'\n",
2222
"\n",
@@ -28,73 +28,67 @@
2828
"execution_count": 3,
2929
"metadata": {},
3030
"outputs": [
31-
{
32-
"name": "stderr",
33-
"output_type": "stream",
34-
"text": [
35-
"DATETIME: 2019-07-09 21:13:28,268 INFO Extracting dates from the text.\n"
36-
]
37-
},
3831
{
3932
"name": "stdout",
4033
"output_type": "stream",
4134
"text": [
4235
"TEXT: Today is 10/12/16 and tomorrow is January 01 2019.\n",
43-
"\n",
44-
"datetime(date='january 01 2019', token_span=(34, 49), token_index=(6, 8), format='%B %d %Y')\n",
45-
"----------------------------------------------------------------------------------------------------\n",
46-
"datetime(date='10/12/16', token_span=(9, 17), token_index=(2, 2), format='%d/%m/%y')\n",
47-
"----------------------------------------------------------------------------------------------------\n",
48-
"****************************************************************************************************\n"
36+
"\n"
4937
]
5038
},
5139
{
5240
"name": "stderr",
5341
"output_type": "stream",
5442
"text": [
55-
"DATETIME: 2019-07-09 21:13:28,509 INFO Extracting dates from the text.\n"
43+
"DATETIME: 2019-07-11 16:49:44,986 INFO Extracting dates from the text.\n"
5644
]
5745
},
5846
{
5947
"name": "stdout",
6048
"output_type": "stream",
6149
"text": [
62-
"TEXT: entries are due by January 4, 2017 at 8:00pm\n",
63-
"\n",
64-
"EXTRACTION FAILED.\n",
65-
"\n",
66-
"****************************************************************************************************\n"
50+
"datetime(date='january 01 2019', token_span=(34, 49), token_index=(6, 8), format='%B %d %Y')\n",
51+
"----------------------------------------------------------------------------------------------------\n",
52+
"datetime(date='10/12/16', token_span=(9, 17), token_index=(2, 2), format='%d/%m/%y')\n",
53+
"----------------------------------------------------------------------------------------------------\n",
54+
"****************************************************************************************************\n",
55+
"TEXT: entries are due by January 04, 2017 at 8:00pm\n",
56+
"\n"
6757
]
6858
},
6959
{
7060
"name": "stderr",
7161
"output_type": "stream",
7262
"text": [
73-
"DATETIME: 2019-07-09 21:13:28,744 INFO Extracting dates from the text.\n"
63+
"DATETIME: 2019-07-11 16:49:45,222 INFO Extracting dates from the text.\n"
7464
]
7565
},
7666
{
7767
"name": "stdout",
7868
"output_type": "stream",
7969
"text": [
80-
"TEXT: created 01/15/2005 by ACME Inc. and associates.\n",
81-
"\n",
82-
"datetime(date='01/15', token_span=(8, 13), token_index=(1, 1), format='%m/%d')\n",
70+
"datetime(date='january 04, 2017', token_span=(19, 35), token_index=(4, 6), format='%B %d, %Y')\n",
8371
"----------------------------------------------------------------------------------------------------\n",
84-
"****************************************************************************************************\n"
72+
"****************************************************************************************************\n",
73+
"TEXT: created 01/15/2005 by ACME Inc. and associates.\n",
74+
"\n"
8575
]
8676
},
8777
{
8878
"name": "stderr",
8979
"output_type": "stream",
9080
"text": [
91-
"DATETIME: 2019-07-09 21:13:28,987 INFO Extracting dates from the text.\n"
81+
"DATETIME: 2019-07-11 16:49:45,455 INFO Extracting dates from the text.\n",
82+
"DATETIME: 2019-07-11 16:49:45,693 INFO Extracting dates from the text.\n"
9283
]
9384
},
9485
{
9586
"name": "stdout",
9687
"output_type": "stream",
9788
"text": [
89+
"datetime(date='01/15', token_span=(8, 13), token_index=(1, 1), format='%m/%d')\n",
90+
"----------------------------------------------------------------------------------------------------\n",
91+
"****************************************************************************************************\n",
9892
"TEXT: Dec.01.2015 - Dec 31 2015 - Dec,12,2015 - Dec,12,2015 - Dec,12th,2015 - DEC122014\n",
9993
"\n",
10094
"datetime(date='dec 31 2015', token_span=(14, 25), token_index=(2, 4), format='%b %d %Y')\n",
@@ -115,7 +109,8 @@
115109
"for text in texts:\n",
116110
" TEXT = f\"TEXT: {text}\\n\"\n",
117111
" try:\n",
118-
" parsed_dates = DateTimeParser(text, 2000, 2020, ['%b%d%Y', '%b.%d.%Y', '%b,%d,%Y', '%b,%d and %Y']) # pass your own custom formats, or just leave it.\n",
112+
" parsed_dates = DateTimeParser(text=text, start_year=2000, end_year=2020, \n",
113+
" datetime_format=['%b%d%Y', '%b.%d.%Y', '%b,%d,%Y', '%b,%d and %Y']) # pass your own custom formats, or just leave it.\n",
119114
" print(TEXT)\n",
120115
" for datetime in parsed_dates.datetime:\n",
121116
" print(datetime)\n",

0 commit comments

Comments
 (0)