INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
This function is called when time for restart is up
def _declareTimeoutExceeded(self, ev_data: RestartLogData): """ This function is called when time for restart is up """ logger.info("Timeout exceeded for {}".format(ev_data.when)) last = self._actionLog.last_event if (last and last.ev_type == RestartLog.Events.failed and ...
Checks last record in upgrade log to find out whether it is about scheduling upgrade. If so - checks whether current version is equals to the one in that record :returns: upgrade execution result
def didLastExecutedUpgradeSucceeded(self) -> bool: """ Checks last record in upgrade log to find out whether it is about scheduling upgrade. If so - checks whether current version is equals to the one in that record :returns: upgrade execution result """ lastEven...
Checks ledger for planned but not yet performed upgrades and schedules upgrade for the most recent one Assumption: Only version is enough to identify a release, no hash checking is done :return:
def processLedger(self) -> None: """ Checks ledger for planned but not yet performed upgrades and schedules upgrade for the most recent one Assumption: Only version is enough to identify a release, no hash checking is done :return: """ logger.debug( ...
Handles transaction of type POOL_UPGRADE Can schedule or cancel upgrade to a newer version at specified time :param txn:
def handleUpgradeTxn(self, txn) -> None: """ Handles transaction of type POOL_UPGRADE Can schedule or cancel upgrade to a newer version at specified time :param txn: """ FINALIZING_EVENT_TYPES = [UpgradeLog.Events.succeeded, UpgradeLog.Events.failed] if ...
Schedules node upgrade to a newer version :param ev_data: upgrade event parameters
def _scheduleUpgrade(self, ev_data: UpgradeLogData, failTimeout) -> None: """ Schedules node upgrade to a newer version :param ev_data: upgrade event parameters """ logger.info( "{}'s upgrader processing upgrade for v...
Cancels scheduled upgrade :param when: time upgrade was scheduled to :param version: version upgrade scheduled for
def _cancelScheduledUpgrade(self, justification=None) -> None: """ Cancels scheduled upgrade :param when: time upgrade was scheduled to :param version: version upgrade scheduled for """ if self.scheduledAction: why_prefix = ": " why = justificati...
Callback which is called when upgrade time come. Writes upgrade record to upgrade log and asks node control service to perform upgrade :param when: upgrade time :param version: version to upgrade to
def _callUpgradeAgent(self, ev_data, failTimeout) -> None: """ Callback which is called when upgrade time come. Writes upgrade record to upgrade log and asks node control service to perform upgrade :param when: upgrade time :param version: version to upgrade to "...
Validates schedule of planned node upgrades :param schedule: dictionary of node ids and upgrade times :param node_srvs: dictionary of node ids and services :return: a 2-tuple of whether schedule valid or not and the reason
def isScheduleValid(self, schedule, node_srvs, force) -> (bool, str): """ Validates schedule of planned node upgrades :param schedule: dictionary of node ids and upgrade times :param node_srvs: dictionary of node ids and services :return: a 2-tuple of whether schedule valid or n...
This function is called when time for upgrade is up
def _declareTimeoutExceeded(self, ev_data: UpgradeLogData): """ This function is called when time for upgrade is up """ logger.info("Timeout exceeded for {}:{}" .format(ev_data.when, ev_data.version)) last = self._actionLog.last_event # TODO test this ...
Retrieves a temporary access token
def get_token(self, url): """ Retrieves a temporary access token """ # A hack to avoid url-encoding the url, since the authorization service # doesn't work with correctly encoded urls parsed_url = urlparse.urlsplit(url) parsed_url = parsed_url._replace(path='/aut...
Synthesizes text to spoken audio using web sockets. It supports the use of the SSML <mark> element to identify the location of user-specified markers in the audio. It can also return timing information for all strings of the input text. Note:The service processes one request per connection. ...
def synthesize_using_websocket(self, text, synthesize_callback, accept=None, voice=None, timings=None, customi...
Classify images. Classify images with built-in or custom classifiers. :param file images_file: An image file (.gif, .jpg, .png, .tif) or .zip file with images. Maximum image size is 10 MB. Include no more than 20 images and limit the .zip file to 100 MB. Encode the image and .zip file ...
def classify(self, images_file=None, images_filename=None, images_file_content_type=None, url=None, threshold=None, owners=None, classifier_ids=None, accept_language=None, ...
Create a classifier. Train a new multi-faceted classifier on the uploaded image data. Create your custom classifier with positive or negative examples. Include at least two sets of examples, either two positive example files or one positive and one negative file. You can upload a maximu...
def create_classifier(self, name, positive_examples, negative_examples=None, negative_examples_filename=None, **kwargs): """ Create a classifier. Train a new multi-f...
Delete a classifier. :param str classifier_id: The ID of the classifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_classifier(self, classifier_id, **kwargs): """ Delete a classifier. :param str classifier_id: The ID of the classifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'class_name') and self.class_name is not None: _dict['class'] = self.class_name return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'class_name') and self.class_name is not None: _dict['class'] = self.class_name if hasattr(self, 'score') and self.score is not None: _dict['score'] = self.scor...
Initialize a ClassifiedImage object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a ClassifiedImage object from a json dictionary.""" args = {} if 'source_url' in _dict: args['source_url'] = _dict.get('source_url') if 'resolved_url' in _dict: args['resolved_url'] = _dict.get('resolved_url') if '...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'source_url') and self.source_url is not None: _dict['source_url'] = self.source_url if hasattr(self, 'resolved_url') and self.resolved_url is not None: _dict['...
Initialize a Classifier object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Classifier object from a json dictionary.""" args = {} if 'classifier_id' in _dict: args['classifier_id'] = _dict.get('classifier_id') else: raise ValueError( 'Required property \'classifier_id\' not pres...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'classifier_id') and self.classifier_id is not None: _dict['classifier_id'] = self.classifier_id if hasattr(self, 'name') and self.name is not None: _dict['name...
Initialize a ClassifierResult object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a ClassifierResult object from a json dictionary.""" args = {} if 'name' in _dict: args['name'] = _dict.get('name') else: raise ValueError( 'Required property \'name\' not present in ClassifierResult JSON' ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'classifier_id') and self.classifier_id is not None: _dict['classifier_id'] = self...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'classifiers') and self.classifiers is not None: _dict['classifiers'] = [x._to_dict() for x in self.classifiers] return _dict
Initialize a DetectedFaces object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a DetectedFaces object from a json dictionary.""" args = {} if 'images_processed' in _dict: args['images_processed'] = _dict.get('images_processed') else: raise ValueError( 'Required property \'images_proce...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'images_processed') and self.images_processed is not None: _dict['images_processed'] = self.images_processed if hasattr(self, 'images') and self.images i...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'code') and self.code is not None: _dict['code'] = self.code if hasattr(self, 'description') and self.description is not None: _dict['description'] = self.descr...
Initialize a Face object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Face object from a json dictionary.""" args = {} if 'age' in _dict: args['age'] = FaceAge._from_dict(_dict.get('age')) if 'gender' in _dict: args['gender'] = FaceGender._from_dict(_dict.get('gender')) if 'face_lo...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'age') and self.age is not None: _dict['age'] = self.age._to_dict() if hasattr(self, 'gender') and self.gender is not None: _dict['gender'] = self.gender._to_di...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'min') and self.min is not None: _dict['min'] = self.min if hasattr(self, 'max') and self.max is not None: _dict['max'] = self.max if hasattr(self, 'sco...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'gender') and self.gender is not None: _dict['gender'] = self.gender if hasattr(self, 'gender_label') and self.gender_label is not None: _dict['gender_label'] =...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'width') and self.width is not None: _dict['width'] = self.width if hasattr(self, 'height') and self.height is not None: _dict['height'] = self.height i...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'warning_id') and self.warning_id is not None: _dict['warning_id'] = self.warning_id if hasattr(self, 'description') and self.description is not None: _dict['de...
Send user input to assistant. Send user input to an assistant and receive a response. There is no rate limit for this operation. :param str assistant_id: Unique identifier of the assistant. You can find the assistant ID of an assistant on the **Assistants** tab of the Watson Assistant ...
def message(self, assistant_id, session_id, input=None, context=None, **kwargs): """ Send user input to assistant. Send user input to an assistant and receive a response. There is no rate limit for this oper...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'group') and self.group is not None: _dict['group'] = self.group if hasattr(self, 'location') and self.location is not None: _dict['location'] = self.location ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'level') and self.level is not None: _dict['level'] = self.level if hasattr(self, 'message') and self.message is not None: _dict['message'] = self.message ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'action_type') and self.action_type is not None: _dict['type'] = self.action_type ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'input') and self.input is not None: _dict['input'] = self.input._to_dict() return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'dialog_node') and self.dialog_node is not None: _dict['dialog_node'] = self.dialog_node if hasattr(self, 'title') and self.title is not None: _dict['title'] = ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'label') and self.label is not None: _dict['label'] = self.label if hasattr(self, 'value') and self.value is not None: _dict['value'] = self.value._to_dict() ...
Initialize a MessageContext object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a MessageContext object from a json dictionary.""" args = {} if 'global' in _dict: args['global_'] = MessageContextGlobal._from_dict( _dict.get('global')) if 'skills' in _dict: args['skills'] = MessageConte...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'global_') and self.global_ is not None: _dict['global'] = self.global_._to_dict() if hasattr(self, 'skills') and self.skills is not None: _dict['skills'] = sel...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'system') and self.system is not None: _dict['system'] = self.system._to_dict() return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'timezone') and self.timezone is not None: _dict['timezone'] = self.timezone if hasattr(self, 'user_id') and self.user_id is not None: _dict['user_id'] = self.u...
Initialize a MessageInput object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a MessageInput object from a json dictionary.""" args = {} if 'message_type' in _dict: args['message_type'] = _dict.get('message_type') if 'text' in _dict: args['text'] = _dict.get('text') if 'options' in _dict: ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'message_type') and self.message_type is not None: _dict['message_type'] = self.message_type if hasattr(self, 'text') and self.text is not None: _dict['text'] =...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'debug') and self.debug is not None: _dict['debug'] = self.debug if hasattr(self, 'restart') and self.restart is not None: _dict['restart'] = self.restart ...
Initialize a MessageOutput object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a MessageOutput object from a json dictionary.""" args = {} if 'generic' in _dict: args['generic'] = [ DialogRuntimeResponseGeneric._from_dict(x) for x in (_dict.get('generic')) ] if 'intent...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'generic') and self.generic is not None: _dict['generic'] = [x._to_dict() for x in self.generic] if hasattr(self, 'intents') and self.intents is not None: _dict...
Initialize a MessageOutputDebug object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a MessageOutputDebug object from a json dictionary.""" args = {} if 'nodes_visited' in _dict: args['nodes_visited'] = [ DialogNodesVisited._from_dict(x) for x in (_dict.get('nodes_visited')) ] ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'nodes_visited') and self.nodes_visited is not None: _dict['nodes_visited'] = [x._to_dict() for x in self.nodes_visited] if hasattr(self, 'log_messages') and self.log_messa...
Initialize a MessageResponse object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a MessageResponse object from a json dictionary.""" args = {} if 'output' in _dict: args['output'] = MessageOutput._from_dict(_dict.get('output')) else: raise ValueError( 'Required property \'output\' not p...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'output') and self.output is not None: _dict['output'] = self.output._to_dict() if hasattr(self, 'context') and self.context is not None: _dict['context'] = sel...
Initialize a RuntimeEntity object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a RuntimeEntity object from a json dictionary.""" args = {} if 'entity' in _dict: args['entity'] = _dict.get('entity') else: raise ValueError( 'Required property \'entity\' not present in RuntimeEntity JSON...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'entity') and self.entity is not None: _dict['entity'] = self.entity if hasattr(self, 'location') and self.location is not None: _dict['location'] = self.locati...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'intent') and self.intent is not None: _dict['intent'] = self.intent if hasattr(self, 'confidence') and self.confidence is not None: _dict['confidence'] = self....
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'session_id') and self.session_id is not None: _dict['session_id'] = self.session_id return _dict
Analyze text. Analyzes text, HTML, or a public webpage for the following features: - Categories - Concepts - Emotion - Entities - Keywords - Metadata - Relations - Semantic roles - Sentiment - Syntax (Experimental). :param...
def analyze(self, features, text=None, html=None, url=None, clean=None, xpath=None, fallback_to_raw=None, return_analyzed_text=None, language=None, limit_text_c...
List models. Lists Watson Knowledge Studio [custom models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html) that are deployed to your Natural Language Understanding service. :param dict headers: A `dict` containing the request headers :return...
def list_models(self, **kwargs): """ List models. Lists Watson Knowledge Studio [custom models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html) that are deployed to your Natural Language Understanding service. :param dict headers: A ...
Initialize a AnalysisResults object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a AnalysisResults object from a json dictionary.""" args = {} if 'language' in _dict: args['language'] = _dict.get('language') if 'analyzed_text' in _dict: args['analyzed_text'] = _dict.get('analyzed_text') if 'ret...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'language') and self.language is not None: _dict['language'] = self.language if hasattr(self, 'analyzed_text') and self.analyzed_text is not None: _dict['analyz...
Initialize a AnalysisResultsMetadata object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a AnalysisResultsMetadata object from a json dictionary.""" args = {} if 'authors' in _dict: args['authors'] = [ Author._from_dict(x) for x in (_dict.get('authors')) ] if 'publication_date' in _dict: ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'authors') and self.authors is not None: _dict['authors'] = [x._to_dict() for x in self.authors] if hasattr(self, 'publication_date') and self.publicatio...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'features') and self.features is not None: _dict['features'] = self.features if hasattr(self, 'text_characters') and self.text_characters is not None: ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'model') and self.model is not None: _dict['model'] = self.model retur...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'label') and self.label is not None: _dict['label'] = self.label if hasattr(self, 'score') and self.score is not None: _dict['score'] = self.score retur...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'text') and self.text is not None: _dict['text'] = self.text if hasattr(self, 'relevance') and self.relevance is not None: _dict['relevance'] = self.relevance ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'deleted') and self.deleted is not None: _dict['deleted'] = self.deleted return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'dbpedia_resource') and self.dbpedia_resource is not None: _dic...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'emotion') and self.emotion is not None: _dict['emotion'] = self.emotion._to_dict() return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'document') and self.document is not None: _dict['document'] = self.document if hasattr(self, 'targets') and self.targets is not None: _dict['targets'] = self.t...
Initialize a EmotionResult object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a EmotionResult object from a json dictionary.""" args = {} if 'document' in _dict: args['document'] = DocumentEmotionResults._from_dict( _dict.get('document')) if 'targets' in _dict: args['targets'] = [ ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'anger') and self.anger is not None: _dict['anger'] = self.anger if hasattr(self, 'disgust') and self.disgust is not None: _dict['disgust'] = self.disgust ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'mentions') and self.mentions is not None: _dict['mentions'] = self.mentions ...
Initialize a EntitiesResult object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a EntitiesResult object from a json dictionary.""" args = {} if 'type' in _dict: args['type'] = _dict.get('type') if 'text' in _dict: args['text'] = _dict.get('text') if 'relevance' in _dict: args['rele...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type if hasattr(self, 'text') and self.text is not None: _dict['text'] = self.text if hasattr(se...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'score') and self.score is not None: _dict['score'] = self.score return _dict
Initialize a Features object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Features object from a json dictionary.""" args = {} if 'concepts' in _dict: args['concepts'] = ConceptsOptions._from_dict(_dict.get('concepts')) if 'emotion' in _dict: args['emotion'] = EmotionOptions._from_dict(_dict.g...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'concepts') and self.concepts is not None: _dict['concepts'] = self.concepts._to_dict() if hasattr(self, 'emotion') and self.emotion is not None: _dict['emotion...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'link') and self.link is not None: _dict['link'] = self.link return _dict
Initialize a KeywordsResult object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a KeywordsResult object from a json dictionary.""" args = {} if 'count' in _dict: args['count'] = _dict.get('count') if 'relevance' in _dict: args['relevance'] = _dict.get('relevance') if 'text' in _dict: ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'count') and self.count is not None: _dict['count'] = self.count if hasattr(self, 'relevance') and self.relevance is not None: _dict['relevance'] = self.relevan...
Initialize a ListModelsResults object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a ListModelsResults object from a json dictionary.""" args = {} if 'models' in _dict: args['models'] = [ Model._from_dict(x) for x in (_dict.get('models')) ] return cls(**args)
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'models') and self.models is not None: _dict['models'] = [x._to_dict() for x in self.models] return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status if hasattr(self, 'model_id') and self.model_id is not None: _dict['model_id'] = self.model_...
Initialize a RelationArgument object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a RelationArgument object from a json dictionary.""" args = {} if 'entities' in _dict: args['entities'] = [ RelationEntity._from_dict(x) for x in (_dict.get('entities')) ] if 'location' in _dict: ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'entities') and self.entities is not None: _dict['entities'] = [x._to_dict() for x in self.entities] if hasattr(self, 'location') and self.location is not None: ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'model') and self.model is not None: _dict['model'] = self.model return _dict
Initialize a RelationsResult object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a RelationsResult object from a json dictionary.""" args = {} if 'score' in _dict: args['score'] = _dict.get('score') if 'sentence' in _dict: args['sentence'] = _dict.get('sentence') if 'type' in _dict: ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'score') and self.score is not None: _dict['score'] = self.score if hasattr(self, 'sentence') and self.sentence is not None: _dict['sentence'] = self.sentence ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type if hasattr(self, 'text') and self.text is not None: _dict['text'] = self.text return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'text') and self.text is not None: _dict['text'] = self.text return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'keywords') and self.keywords is not None: _dict['keywords'] = self.keywords ...
Initialize a SemanticRolesResult object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a SemanticRolesResult object from a json dictionary.""" args = {} if 'sentence' in _dict: args['sentence'] = _dict.get('sentence') if 'subject' in _dict: args['subject'] = SemanticRolesResultSubject._from_dict( ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'sentence') and self.sentence is not None: _dict['sentence'] = self.sentence if hasattr(self, 'subject') and self.subject is not None: _dict['subject'] = self.s...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'text') and self.text is not None: _dict['text'] = self.text if hasattr(self, 'normalized') and self.normalized is not None: _dict['normalized'] = self.normaliz...
Initialize a SemanticRolesResultObject object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a SemanticRolesResultObject object from a json dictionary.""" args = {} if 'text' in _dict: args['text'] = _dict.get('text') if 'keywords' in _dict: args['keywords'] = [ SemanticRolesKeyword._from_dict(x) ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'text') and self.text is not None: _dict['text'] = self.text if hasattr(self, 'keywords') and self.keywords is not None: _dict['keywords'] = [x._to_dict() for x...
Initialize a SemanticRolesResultSubject object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a SemanticRolesResultSubject object from a json dictionary.""" args = {} if 'text' in _dict: args['text'] = _dict.get('text') if 'entities' in _dict: args['entities'] = [ SemanticRolesEntity._from_dict(x) ...