INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
Initialize a WordAlternativeResults object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a WordAlternativeResults object from a json dictionary.""" args = {} if 'start_time' in _dict: args['start_time'] = _dict.get('start_time') else: raise ValueError( 'Required property \'start_time\' not pres...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'start_time') and self.start_time is not None: _dict['start_time'] = self.start_time if hasattr(self, 'end_time') and self.end_time is not None: _dict['end_time...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'element') and self.element is not None: _dict['element'] = self.element return _dict
Initialize a Words object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Words object from a json dictionary.""" args = {} if 'words' in _dict: args['words'] = [Word._from_dict(x) for x in (_dict.get('words'))] else: raise ValueError( 'Required property \'words\' not present i...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'words') and self.words is not None: _dict['words'] = [x._to_dict() for x in self.words] return _dict
updateUserTone processes the Tone Analyzer payload to pull out the emotion, writing and social tones, and identify the meaningful tones (i.e., those tones that meet the specified thresholds). The conversationPayload json object is updated to include these tones. @param conversationPayload json object re...
def updateUserTone(conversationPayload, toneAnalyzerPayload, maintainHistory): """ updateUserTone processes the Tone Analyzer payload to pull out the emotion, writing and social tones, and identify the meaningful tones (i.e., those tones that meet the specified thresholds). The conversationPayload j...
updateWritingTone updates the user with the writing tones interpreted based on the specified thresholds @param: user a json object representing user information (tone) to be used in conversing with the Conversation Service @param: writingTone a json object containing the writing tones in the payload...
def updateWritingTone(user, writingTone, maintainHistory): """ updateWritingTone updates the user with the writing tones interpreted based on the specified thresholds @param: user a json object representing user information (tone) to be used in conversing with the Conversation Service @param: wr...
updateEmotionTone updates the user emotion tone with the primary emotion - the emotion tone that has a score greater than or equal to the EMOTION_SCORE_THRESHOLD; otherwise primary emotion will be 'neutral' @param user a json object representing user information (tone) to be used in conversing with the ...
def updateEmotionTone(user, emotionTone, maintainHistory): """ updateEmotionTone updates the user emotion tone with the primary emotion - the emotion tone that has a score greater than or equal to the EMOTION_SCORE_THRESHOLD; otherwise primary emotion will be 'neutral' @param user a json object repr...
updateSocialTone updates the user with the social tones interpreted based on the specified thresholds @param user a json object representing user information (tone) to be used in conversing with the Conversation Service @param socialTone a json object containing the social tones in the payload retur...
def updateSocialTone(user, socialTone, maintainHistory): """ updateSocialTone updates the user with the social tones interpreted based on the specified thresholds @param user a json object representing user information (tone) to be used in conversing with the Conversation Service @param socialTo...
Synthesize audio. Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text. The method accepts a maximum of 5 KB of input text i...
def synthesize(self, text, voice=None, customization_id=None, accept=None, **kwargs): """ Synthesize audio. Synthesizes text to audio that is spoken in the specified voice. The service bases i...
Update a custom model. Updates information for the specified custom voice model. You can update metadata such as the name and description of the voice model. You can also update the words in the model and their translations. Adding a new translation for a word that already exists in a c...
def update_voice_model(self, customization_id, name=None, description=None, words=None, **kwargs): """ Update a custom model. Updates information for the specif...
Add a custom word. Adds a single word and its translation to the specified custom voice model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use crede...
def add_word(self, customization_id, word, translation, part_of_speech=None, **kwargs): """ Add a custom word. Adds a single word and its translation to the specified custom voice model. Adding a new tr...
Delete labeled data. Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the...
def delete_user_data(self, customer_id, **kwargs): """ Delete labeled data. Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'pronunciation') and self.pronunciation is not None: _dict['pronunciation'] = self.pronunciation return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'custom_pronunciation' ) and self.custom_pronunciation is not None: _dict['custom_pronunciation'] = self.custom_pronunciation if hasattr(self, 'voice_tran...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'url') and self.url is not None: _dict['url'] = self.url if hasattr(self, 'gender') and self.gender is not None: _dict['gender'] = self.gender if hasatt...
Initialize a VoiceModel object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a VoiceModel object from a json dictionary.""" args = {} if 'customization_id' in _dict: args['customization_id'] = _dict.get('customization_id') else: raise ValueError( 'Required property \'customization_i...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'customization_id') and self.customization_id is not None: _dict['customization_id'] = self.customization_id if hasattr(self, 'name') and self.name is no...
Initialize a VoiceModels object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a VoiceModels object from a json dictionary.""" args = {} if 'customizations' in _dict: args['customizations'] = [ VoiceModel._from_dict(x) for x in (_dict.get('customizations')) ] else: raise V...
Initialize a Voices object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Voices object from a json dictionary.""" args = {} if 'voices' in _dict: args['voices'] = [ Voice._from_dict(x) for x in (_dict.get('voices')) ] else: raise ValueError( 'Requir...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'voices') and self.voices is not None: _dict['voices'] = [x._to_dict() for x in self.voices] return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'word') and self.word is not None: _dict['word'] = self.word if hasattr(self, 'translation') and self.translation is not None: _dict['translation'] = self.trans...
invokeToneConversation calls the Tone Analyzer service to get the tone information for the user's input text (input['text'] in the payload json object), adds/updates the user's tone in the payload's context, and sends the payload to the conversation service to get a response which is printed to scre...
def invokeToneConversation(payload, maintainToneHistoryInContext): """ invokeToneConversation calls the Tone Analyzer service to get the tone information for the user's input text (input['text'] in the payload json object), adds/updates the user's tone in the payload's context, and sends the pay...
Convert document to HTML. Converts a document to HTML. :param file file: The document to convert. :param str filename: The filename for file. :param str file_content_type: The content type of file. :param str model: The analysis model to be used by the service. For the **Elemen...
def convert_to_html(self, file, filename=None, file_content_type=None, model=None, **kwargs): """ Convert document to HTML. Converts a document to HTML. :param file f...
Classify the elements of a document. Analyzes the structural and semantic elements of a document. :param file file: The document to classify. :param str file_content_type: The content type of file. :param str model: The analysis model to be used by the service. For the **Element ...
def classify_elements(self, file, file_content_type=None, model=None, **kwargs): """ Classify the elements of a document. Analyzes the structural and semantic elements of a document. ...
Compare two documents. Compares two input documents. Documents must be in the same format. :param file file_1: The first document to compare. :param file file_2: The second document to compare. :param str file_1_content_type: The content type of file_1. :param str file_2_conten...
def compare_documents(self, file_1, file_2, file_1_content_type=None, file_2_content_type=None, file_1_label=None, file_2_label=None, mode...
Add feedback. Adds feedback in the form of _labels_ from a subject-matter expert (SME) to a governing document. **Important:** Feedback is not immediately incorporated into the training model, nor is it guaranteed to be incorporated at a later date. Instead, submitted feedback i...
def add_feedback(self, feedback_data, user_id=None, comment=None, **kwargs): """ Add feedback. Adds feedback in the form of _labels_ from a subject-matter expert (SME) to a governing document. **Important:** Feedback is not immediately incorporated into the training model, ...
List a specified feedback entry. Lists a feedback entry with a specified `feedback_id`. :param str feedback_id: A string that specifies the feedback entry to be included in the output. :param str model: The analysis model to be used by the service. For the **Element classificat...
def get_feedback(self, feedback_id, model=None, **kwargs): """ List a specified feedback entry. Lists a feedback entry with a specified `feedback_id`. :param str feedback_id: A string that specifies the feedback entry to be included in the output. :param str model: The ...
List the feedback in a document. Lists the feedback in a document. :param str feedback_type: An optional string that filters the output to include only feedback with the specified feedback type. The only permitted value is `element_classification`. :param date before: An option...
def list_feedback(self, feedback_type=None, before=None, after=None, document_title=None, model_id=None, model_version=None, category_removed=None, ...
Submit a batch-processing request. Run Compare and Comply methods over a collection of input documents. **Important:** Batch processing requires the use of the [IBM Cloud Object Storage service](https://cloud.ibm.com/docs/services/cloud-object-storage/about-cos.html#about-ibm-cloud-object-stora...
def create_batch(self, function, input_credentials_file, input_bucket_location, input_bucket_name, output_credentials_file, output_bucket_location, output_bucket_name, ...
Initialize a AlignedElement object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a AlignedElement object from a json dictionary.""" args = {} if 'element_pair' in _dict: args['element_pair'] = [ ElementPair._from_dict(x) for x in (_dict.get('element_pair')) ] if 'identical_text' in _dic...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'element_pair') and self.element_pair is not None: _dict['element_pair'] = [x._to_dict() for x in self.element_pair] if hasattr(self, 'identical_text') and self.identical_t...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'function') and self.function is not None: _dict['function'] = self.function if hasattr(self, 'input_bucket_location' ) and self.input_bucket_location is ...
Initialize a Batches object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Batches object from a json dictionary.""" args = {} if 'batches' in _dict: args['batches'] = [ BatchStatus._from_dict(x) for x in (_dict.get('batches')) ] 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, 'batches') and self.batches is not None: _dict['batches'] = [x._to_dict() for x in self.batches] return _dict
Initialize a BodyCells object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a BodyCells object from a json dictionary.""" args = {} if 'cell_id' in _dict: args['cell_id'] = _dict.get('cell_id') if 'location' in _dict: args['location'] = Location._from_dict(_dict.get('location')) if 'text' ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'cell_id') and self.cell_id is not None: _dict['cell_id'] = self.cell_id if hasattr(self, 'location') and self.location is not None: _dict['location'] = self.lo...
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, 'provenance_ids') and self.provenance_ids is not None: _dict['provenance_ids']...
Initialize a ClassifyReturn object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a ClassifyReturn object from a json dictionary.""" args = {} if 'document' in _dict: args['document'] = Document._from_dict(_dict.get('document')) if 'model_id' in _dict: args['model_id'] = _dict.get('model_id') if...
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._to_dict() if hasattr(self, 'model_id') and self.model_id is not None: _dict['model...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id 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_normalized') and self.text_normalized is not None: _dict['text_normalized'] = self.text_normalized return _dict
Initialize a CompareReturn object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a CompareReturn object from a json dictionary.""" args = {} if 'model_id' in _dict: args['model_id'] = _dict.get('model_id') if 'model_version' in _dict: args['model_version'] = _dict.get('model_version') if 'docum...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'model_id') and self.model_id is not None: _dict['model_id'] = self.model_id if hasattr(self, 'model_version') and self.model_version is not None: _dict['model_...
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, 'role') and self.role is not None: _dict['role'] = self.role return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'total') and self.total is not None: _dict['total'] = self.total if hasattr(self, 'pending') and self.pending is not None: _dict['pending'] = self.pending ...
Initialize a DocStructure object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a DocStructure object from a json dictionary.""" args = {} if 'section_titles' in _dict: args['section_titles'] = [ SectionTitles._from_dict(x) for x in (_dict.get('section_titles')) ] if 'l...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'section_titles') and self.section_titles is not None: _dict['section_titles'] = [ x._to_dict() for x in self.section_titles ] if hasattr(self, ...
Initialize a Element object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Element object from a json dictionary.""" args = {} if 'location' in _dict: args['location'] = Location._from_dict(_dict.get('location')) if 'text' in _dict: args['text'] = _dict.get('text') if 'types' in _dict: ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'begin') and self.begin is not None: _dict['begin'] = self.begin if hasattr(self, 'end') and self.end is not None: _dict['end'] = self.end return _dict
Initialize a FeedbackDataInput object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a FeedbackDataInput object from a json dictionary.""" args = {} if 'feedback_type' in _dict: args['feedback_type'] = _dict.get('feedback_type') else: raise ValueError( 'Required property \'feedback_type\' n...
Initialize a FeedbackDataOutput object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a FeedbackDataOutput object from a json dictionary.""" args = {} if 'feedback_type' in _dict: args['feedback_type'] = _dict.get('feedback_type') if 'document' in _dict: args['document'] = ShortDoc._from_dict(_dict.get('doc...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'feedback_type') and self.feedback_type is not None: _dict['feedback_type'] = self.feedback_type if hasattr(self, 'document') and self.document is not None: _di...
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, 'message') and self.message is not None: _dict['message'] = self.message ...
Initialize a FeedbackList object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a FeedbackList object from a json dictionary.""" args = {} if 'feedback' in _dict: args['feedback'] = [ GetFeedback._from_dict(x) for x in (_dict.get('feedback')) ] 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, 'feedback') and self.feedback is not None: _dict['feedback'] = [x._to_dict() for x in self.feedback] return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'feedback_id') and self.feedback_id is not None: _dict['feedback_id'] = self.feedback_id if hasattr(self, 'user_id') and self.user_id is not None: _dict['user_i...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'num_pages') and self.num_pages is not None: _dict['num_pages'] = self.num_pages if hasattr(self, 'author') and self.author is not None: _dict['author'] = self....
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'cell_id') and self.cell_id is not None: _dict['cell_id'] = self.cell_id if hasattr(self, 'location') and self.location is not None: _dict['location'] = self.lo...
Initialize a KeyValuePair object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a KeyValuePair object from a json dictionary.""" args = {} if 'key' in _dict: args['key'] = Key._from_dict(_dict.get('key')) if 'value' in _dict: args['value'] = Value._from_dict(_dict.get('value')) return cls(**ar...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'key') and self.key is not None: _dict['key'] = self.key._to_dict() if hasattr(self, 'value') and self.value is not None: _dict['value'] = self.value._to_dict()...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'nature') and self.nature is not None: _dict['nature'] = self.nature if hasattr(self, 'party') and self.party is not None: _dict['party'] = self.party r...
Initialize a LeadingSentence object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a LeadingSentence object from a json dictionary.""" args = {} if 'text' in _dict: args['text'] = _dict.get('text') if 'location' in _dict: args['location'] = Location._from_dict(_dict.get('location')) if 'element_l...
Initialize a OriginalLabelsIn object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a OriginalLabelsIn object from a json dictionary.""" args = {} if 'types' in _dict: args['types'] = [ TypeLabel._from_dict(x) for x in (_dict.get('types')) ] else: raise ValueError( ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'types') and self.types is not None: _dict['types'] = [x._to_dict() for x in self.types] if hasattr(self, 'categories') and self.categories is not None: _dict['...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'refresh_cursor') and self.refresh_cursor is not None: _dict['refresh_cursor'] = self.refresh_cursor if hasattr(self, 'next_cursor') and self.next_cursor is not None: ...
Initialize a Parties object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Parties object from a json dictionary.""" args = {} if 'party' in _dict: args['party'] = _dict.get('party') if 'importance' in _dict: args['importance'] = _dict.get('importance') if 'role' in _dict: a...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'party') and self.party is not None: _dict['party'] = self.party if hasattr(self, 'importance') and self.importance is not None: _dict['importance'] = self.impo...
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, 'location') and self.location is not None: _dict['location'] = self.location._to_d...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'title') and self.title is not None: _dict['title'] = self.title if hasattr(self, 'hash') and self.hash is not None: _dict['hash'] = self.hash return _d...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'cell_id') and self.cell_id is not None: _dict['cell_id'] = self.cell_id if hasattr(self, 'location') and self.location is not None: _dict['location'] = self.lo...
Initialize a TableReturn object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a TableReturn object from a json dictionary.""" args = {} if 'document' in _dict: args['document'] = DocInfo._from_dict(_dict.get('document')) if 'model_id' in _dict: args['model_id'] = _dict.get('model_id') if 'mo...
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._to_dict() if hasattr(self, 'model_id') and self.model_id is not None: _dict['model...
Initialize a Tables object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Tables object from a json dictionary.""" args = {} if 'location' in _dict: args['location'] = Location._from_dict(_dict.get('location')) if 'text' in _dict: args['text'] = _dict.get('text') if 'section_title' in ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'location') and self.location is not None: _dict['location'] = self.location._to_dict() if hasattr(self, 'text') and self.text is not None: _dict['text'] = self...
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._to_dict() return _dict
Initialize a UnalignedElement object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a UnalignedElement object from a json dictionary.""" args = {} if 'document_label' in _dict: args['document_label'] = _dict.get('document_label') if 'location' in _dict: args['location'] = Location._from_dict(_dict.get('lo...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'document_label') and self.document_label is not None: _dict['document_label'] = self.document_label if hasattr(self, 'location') and self.location is not None: ...
Sends audio for speech recognition using web sockets. :param AudioSource audio: The audio to transcribe in the format specified by the `Content-Type` header. :param str content_type: The type of the input: audio/basic, audio/flac, audio/l16, audio/mp3, audio/mpeg, audio/mulaw, audio/ogg...
def recognize_using_websocket(self, audio, content_type, recognize_callback, model=None, language_customization_id=None, ...
Sends the text message Note: The service handles one request per connection
def send_text(self): """ Sends the text message Note: The service handles one request per connection """ def run(*args): """Background process to send the text""" self.ws_client.send(json.dumps(self.options).encode('utf8')) time.sleep(TEN_MILL...
Callback executed when message is received from the server. :param ws: Websocket client :param message: utf-8 string which we get from the server. :param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY :param fin: continue flag. If 0, the data continues...
def on_data(self, ws, message, message_type, fin): """ Callback executed when message is received from the server. :param ws: Websocket client :param message: utf-8 string which we get from the server. :param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OP...
Send message to server. data: message to send. If you set opcode to OPCODE_TEXT, data must be utf-8 string or unicode. opcode: operation code of data. default is OPCODE_TEXT.
def send(self, data, opcode=websocket.ABNF.OPCODE_TEXT): """ Send message to server. data: message to send. If you set opcode to OPCODE_TEXT, data must be utf-8 string or unicode. opcode: operation code of data. default is OPCODE_TEXT. """ self.ws_client.se...
Stream audio to server :param ws: Websocket client
def send_audio(self, ws): """ Stream audio to server :param ws: Websocket client """ def run(*args): """Background process to stream the data""" if not self.audio_source.is_buffer: while True: chunk = self.audio_source....
Callback executed when a connection is opened to the server. Handles streaming of audio to the server. :param ws: Websocket client
def on_open(self, ws): """ Callback executed when a connection is opened to the server. Handles streaming of audio to the server. :param ws: Websocket client """ self.callback.on_connected() # Send initialization message init_data = self.build_start_mess...
Callback executed when message is received from the server. :param ws: Websocket client :param message: utf-8 string which we get from the server. :param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY :param fin: continue flag. If 0, the data continues...
def on_data(self, ws, message, message_type, fin): """ Callback executed when message is received from the server. :param ws: Websocket client :param message: utf-8 string which we get from the server. :param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OP...
Get profile. Generates a personality profile for the author of the input text. The service accepts a maximum of 20 MB of input content, but it requires much less text to produce an accurate profile. The service can analyze text in Arabic, English, Japanese, Korean, or Spanish. It can re...
def profile(self, content, accept, content_language=None, accept_language=None, raw_scores=None, csv_headers=None, consumption_preferences=None, content_type=None, **kwargs): ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'trait_id') and self.trait_id is not None: _dict['trait_id'] = self.trait_id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'consumption_preference_id' ) and self.consumption_preference_id is not None: _dict['consumption_preference_id'] = self.consumption_preference_id if hasat...
Initialize a ConsumptionPreferencesCategory object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a ConsumptionPreferencesCategory object from a json dictionary.""" args = {} if 'consumption_preference_category_id' in _dict: args['consumption_preference_category_id'] = _dict.get( 'consumption_preference_category_id') ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'consumption_preference_category_id' ) and self.consumption_preference_category_id is not None: _dict[ 'consumption_preference_category_id'] = sel...
Initialize a Content object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Content object from a json dictionary.""" args = {} if 'contentItems' in _dict: args['content_items'] = [ ContentItem._from_dict(x) for x in (_dict.get('contentItems')) ] else: raise ValueErro...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'content_items') and self.content_items is not None: _dict['contentItems'] = [x._to_dict() for x in self.content_items] return _dict
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'content') and self.content is not None: _dict['content'] = self.content if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id if hasatt...
Initialize a Profile object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Profile object from a json dictionary.""" args = {} if 'processed_language' in _dict: args['processed_language'] = _dict.get('processed_language') else: raise ValueError( 'Required property \'processed_la...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr( self, 'processed_language') and self.processed_language is not None: _dict['processed_language'] = self.processed_language if hasattr(self, 'word...
Initialize a Trait object from a json dictionary.
def _from_dict(cls, _dict): """Initialize a Trait object from a json dictionary.""" args = {} if 'trait_id' in _dict: args['trait_id'] = _dict.get('trait_id') else: raise ValueError( 'Required property \'trait_id\' not present in Trait JSON') ...
Return a json dictionary representing this model.
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'trait_id') and self.trait_id is not None: _dict['trait_id'] = self.trait_id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name ...
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, 'message') and self.message is not None: _dict['message'] ...
Delete all chunks for a symbol. Which are, for the moment, fully contained in the passed in date_range. Parameters ---------- symbol : `str` symbol name for the item date_range : `date.DateRange` DateRange to delete ticks in
def delete(self, symbol, date_range=None): """ Delete all chunks for a symbol. Which are, for the moment, fully contained in the passed in date_range. Parameters ---------- symbol : `str` symbol name for the item date_range : `date.DateRange`...
Return the mongo read preference given an 'allow_secondary' argument
def _read_preference(self, allow_secondary): """ Return the mongo read preference given an 'allow_secondary' argument """ allow_secondary = self._allow_secondary if allow_secondary is None else allow_secondary return ReadPreference.NEAREST if allow_secondary else ReadPreference.PRIMARY