A Python wrapper for Stanford CoreNLP’s SUTime.
sutime.sutime.
SUTime
(jars: Optional[str] = None, jvm_started: Optional[bool] = False, mark_time_ranges: Optional[bool] = False, include_range: Optional[bool] = False, jvm_flags: Optional[List[str]] = None, language: Optional[str] = 'english')¶Python wrapper for SUTime (CoreNLP) by Stanford.
Initialize SUTime wrapper.
jars (Optional[str]) – Path to previously downloaded SUTime Java dependencies. Defaults to False.
jvm_started (Optional[bool]) – Flag to indicate that JVM has been already started (with all Java dependencies loaded). Defaults to False.
mark_time_ranges (Optional[bool]) – SUTime flag for sutime.markTimeRanges. Defaults to False. “Whether or not to recognize time ranges such as ‘July to August’”
include_range (Optional[bool]) – SUTime flag for sutime.includeRange. Defaults to False. “Whether or not to add range info to the TIMEX3 object”
jvm_flags (Optional[List[str]]) – List of flags passed to JVM. For example, this may be used to specify the maximum heap size using ‘-Xmx’. Has no effect if jvm_started is set to True. Defaults to None.
language (Optional[str]) – Selected language. Currently supported are: english (/en), british, spanish (/es). Defaults to english.
parse
(input_str: str, reference_date: Optional[str] = '') → List[Dict]¶Parse datetime information out of string input.
It invokes the SUTimeWrapper.annotate() function in Java.
input_str (str) – The input as string that has to be parsed.
reference_date (Optional[str]) – Optional reference data for SUTime. Defaults to ‘’.
A list of dicts with the result from the SUTimeWrapper.annotate() call.
RuntimeError – An error occurs when CoreNLP is not loaded.