5
$\begingroup$

I was surprised to see that Interpreter requires external WR resources as this is not documented, at least not here.

On a 3Ghz iMac, took ~half a minute to process n=68 time strings:

timeData = {"0:12:15", "0:13:00", "0:17:00", "0:00:39", "0:00:25", "0:00:38", 
"0:00:48", "0:05:50", "0:03:34", "0:05:50", "0:00:22", "0:04:05", 
"0:00:07", "0:00:07", "0:00:46", "0:00:02", "0:00:32", "0:00:11", 
"0:00:31", "0:09:55", "0:00:07", "0:00:34", "0:00:36", "0:07:44", 
"0:00:11", "0:00:20", "0:02:29", "0:04:30", "0:00:56", "0:01:23", 
"0:00:05", "0:00:05", "0:00:18", "0:00:13", "0:00:21", "0:00:21", 
"0:00:06", "0:00:13", "0:00:56", "0:00:05", "0:00:15", "0:00:05", 
"0:01:38", "0:00:22", "0:01:43", "0:00:14", "0:09:06", "0:01:39", 
"0:03:17", "0:03:08", "0:00:45", "0:00:36", "0:00:38", "0:00:06", 
"0:00:08", "0:01:07", "0:00:08", "0:01:06", "0:00:11", "0:00:17", 
"0:00:08", "0:00:17", "0:00:09", "0:00:34", "0:00:25", "0:00:31", 
"0:00:07", "0:01:29"};

AbsoluteTiming [Interpreter["Time"][#] & /@ timeData ] // First

26.633811

Timing is much lower, ~3 seconds, though once I ran it and got:

"Interpreter::timeout : "A network operation for Interpreter timed out. Please try again later."

Users can define their own interpreters, but curious if it's possible to make at least part of the functionality available locally? I can't imagine a simpler test case than time strings.

$\endgroup$
12
$\begingroup$

Two solutions:

  1. Use the listability of Interpreter to parallelize calls to WR servers:

     In[1]:= AbsoluteTiming[Interpreter["Time"][timeData]] // First  
     Out[1]= 6.551647
    
  2. Use Structured interpreters to avoid calling WR servers altogether:

    In[2]:= AbsoluteTiming[Interpreter["StructuredTime"][timeData]] // First  
    Out[2]= 0.165715
    

In general you might want to refer to this guide, and to pages that describe the single types.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.