@@ -1023,6 +1023,7 @@ def analyse_text_to_cas(
10231023 language : Optional [str ] = None ,
10241024 timeout : Optional [float ] = None ,
10251025 annotation_types : Union [None , str , List [str ]] = None ,
1026+ meta_data : Optional [dict ] = None ,
10261027 ) -> Cas :
10271028 """
10281029 HIGHLY EXPERIMENTAL API - may soon change or disappear. Processes text using a pipeline and returns the result
@@ -1034,6 +1035,7 @@ def analyse_text_to_cas(
10341035 :param annotation_types: Optional parameter indicating which types should be returned.
10351036 Supports wildcard expressions, e.g. "de.averbis.types.*" returns all types
10361037 with prefix "de.averbis.types". Available from Health Discovery 7.3.0 onwards.
1038+ :param meta_data: Optional key-value pairs that are used as generic metadata in addition to the document
10371039
10381040 :return: A cassis.Cas object
10391041 """
@@ -1047,6 +1049,7 @@ def analyse_text_to_cas(
10471049 language = language ,
10481050 timeout = timeout ,
10491051 annotation_types = annotation_types ,
1052+ meta_data = meta_data ,
10501053 ),
10511054 typesystem = self .get_type_system (),
10521055 )
@@ -1059,6 +1062,7 @@ def analyse_texts_to_cas(
10591062 language : Optional [str ] = None ,
10601063 timeout : Optional [float ] = None ,
10611064 annotation_types : Union [None , str , List [str ]] = None ,
1065+ meta_data : Optional [dict ] = None ,
10621066 ) -> Iterator [Result ]:
10631067 """
10641068 Analyze the given texts or files using the pipeline. If feasible, multiple documents are processed in parallel.
@@ -1083,6 +1087,7 @@ def analyse_texts_to_cas(
10831087 :param annotation_types: Optional parameter indicating which types should be returned.
10841088 Supports wildcard expressions, e.g. "de.averbis.types.*" returns all types
10851089 with prefix "de.averbis.types". Available from Health Discovery 7.3.0 onwards.
1090+ :param meta_data: Optional key-value pairs that are used as generic metadata in addition to the document
10861091
10871092 :return: An iterator over the results produced by the pipeline.
10881093 """
@@ -1093,6 +1098,7 @@ def analyse_texts_to_cas(
10931098 language = language ,
10941099 timeout = timeout ,
10951100 analyse_function = self .analyse_text_to_cas ,
1101+ meta_data = meta_data ,
10961102 )
10971103
10981104 # Ignoring errors as linter (compiler) cannot resolve dynamically loaded lib
@@ -4217,6 +4223,7 @@ def _analyse_text_xmi(
42174223 language : Optional [str ] = None ,
42184224 timeout : Optional [float ] = None ,
42194225 annotation_types : Union [None , str , List [str ]] = None ,
4226+ meta_data : Optional [dict ] = None ,
42204227 ) -> str :
42214228 """
42224229 HIGHLY EXPERIMENTAL API - may soon change or disappear.
@@ -4238,17 +4245,17 @@ def _analyse_text_xmi(
42384245 if "platformVersion" in build_version and self ._is_higher_equal_version (
42394246 build_version ["platformVersion" ], 8 , 16
42404247 ):
4248+ request_params = {
4249+ "language" : language ,
4250+ "annotationTypes" : self ._preprocess_annotation_types (annotation_types ),
4251+ }
4252+ request_params .update (meta_data or {})
42414253 return str (
42424254 self .__request_with_bytes_response (
42434255 "post" ,
42444256 f"/v1/textanalysis/projects/{ project } /pipelines/{ pipeline } /analyseText" ,
42454257 data = data ,
4246- params = {
4247- "language" : language ,
4248- "annotationTypes" : self ._preprocess_annotation_types (
4249- annotation_types
4250- ),
4251- },
4258+ params = request_params ,
42524259 headers = {
42534260 HEADER_CONTENT_TYPE : MEDIA_TYPE_TEXT_PLAIN_UTF8 ,
42544261 HEADER_ACCEPT : MEDIA_TYPE_APPLICATION_XMI ,
@@ -4264,12 +4271,14 @@ def _analyse_text_xmi(
42644271 f"but current platform is { build_version ['platformVersion' ]} ."
42654272 )
42664273 else :
4274+ request_params = {"language" : language }
4275+ request_params .update (meta_data or {})
42674276 return str (
42684277 self .__request_with_bytes_response (
42694278 "post" ,
42704279 f"/experimental/textanalysis/projects/{ project } /pipelines/{ pipeline } /analyzeTextToCas" ,
42714280 data = data ,
4272- params = { "language" : language } ,
4281+ params = request_params ,
42734282 headers = {
42744283 HEADER_CONTENT_TYPE : MEDIA_TYPE_TEXT_PLAIN_UTF8 ,
42754284 HEADER_ACCEPT : MEDIA_TYPE_APPLICATION_XMI ,
0 commit comments