@@ -47,14 +47,15 @@ def load(self):
4747 words TEXT, -- this is a JSON string
4848 firstEncounter INTEGER,
4949 lastEncounter INTEGER,
50- count INTEGER
50+ count INTEGER,
51+ tagTime INTEGER -- time it took to tag the identifier
5152 )
5253 ''' )
5354 #close the database connection
5455 conn .commit ()
5556 conn .close ()
5657
57- def add (self , identifier , result , context ):
58+ def add (self , identifier , result , context , tag_time ):
5859 #connection setup
5960 conn = sqlite3 .connect (self .Path )
6061 cursor = conn .cursor ()
@@ -65,11 +66,12 @@ def add(self, identifier, result, context):
6566 "words" : json .dumps (result ["words" ]),
6667 "firstEncounter" : time .time (),
6768 "lastEncounter" : time .time (),
68- "count" : 1
69+ "count" : 1 ,
70+ "tagTime" : tag_time
6971 }
7072 cursor .execute ('''
71- INSERT INTO names (name, context, words, firstEncounter, lastEncounter, count)
72- VALUES (:name, :context, :words, :firstEncounter, :lastEncounter, :count)
73+ INSERT INTO names (name, context, words, firstEncounter, lastEncounter, count, tagTime )
74+ VALUES (:name, :context, :words, :firstEncounter, :lastEncounter, :count, :tagTime )
7375 ''' , record )
7476 #close the database connection
7577 conn .commit ()
@@ -263,6 +265,9 @@ def listen(identifier_name: str, identifier_context: str, cache_id: str = None)
263265 """
264266 print (f"INPUT: { identifier_name } { identifier_context } " )
265267
268+ # get the start time
269+ start_time = time .perf_counter ()
270+
266271 # Split identifier_name into words
267272 words = ronin .split (identifier_name )
268273
@@ -328,9 +333,12 @@ def listen(identifier_name: str, identifier_context: str, cache_id: str = None)
328333 }
329334 )
330335
336+ # get time it took to tag the identifier
337+ tag_time = time .perf_counter () - start_time
338+
331339 # append result to cache
332340 if cache_id != None :
333- cache .add (identifier_name , result , identifier_context )
341+ cache .add (identifier_name , result , identifier_context , tag_time )
334342
335343 return result
336344
0 commit comments