ibm_watson.discovery_v2 module¶
IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add to applications to identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual filtering of results.
-
class
DiscoveryV2
(version: str, authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None, service_name: str = 'discovery')[source]¶ Bases:
ibm_cloud_sdk_core.base_service.BaseService
The Discovery V2 service.
-
DEFAULT_SERVICE_URL
= 'https://api.us-south.discovery.watson.cloud.ibm.com'¶
-
DEFAULT_SERVICE_NAME
= 'discovery'¶
-
list_collections
(project_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List collections.
Lists existing collections for the specified project.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
create_collection
(project_id: str, name: str, *, description: str = None, language: str = None, enrichments: List[CollectionEnrichment] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Create a collection.
Create a new collection in the specified project.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
name (str) – The name of the collection.
description (str) – (optional) A description of the collection.
language (str) – (optional) The language of the collection.
enrichments (List[CollectionEnrichment]) – (optional) An array of enrichments that are applied to this collection.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
get_collection
(project_id: str, collection_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Get collection.
Get details about the specified collection.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
update_collection
(project_id: str, collection_id: str, *, name: str = None, description: str = None, enrichments: List[CollectionEnrichment] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Update a collection.
Updates the specified collection’s name, description, and enrichments.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
collection_id (str) – The ID of the collection.
name (str) – (optional) The name of the collection.
description (str) – (optional) A description of the collection.
enrichments (List[CollectionEnrichment]) – (optional) An array of enrichments that are applied to this collection.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
delete_collection
(project_id: str, collection_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete a collection.
Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
query
(project_id: str, *, collection_ids: List[str] = None, filter: str = None, query: str = None, natural_language_query: str = None, aggregation: str = None, count: int = None, return_: List[str] = None, offset: int = None, sort: str = None, highlight: bool = None, spelling_suggestions: bool = None, table_results: Optional[ibm_watson.discovery_v2.QueryLargeTableResults] = None, suggested_refinements: Optional[ibm_watson.discovery_v2.QueryLargeSuggestedRefinements] = None, passages: Optional[ibm_watson.discovery_v2.QueryLargePassages] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Query a project.
By using this method, you can construct queries. For details, see the [Discovery documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts). The default query parameters are defined by the settings for this project, see the [Discovery documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-project-defaults) for an overview of the standard default settings, and see [the Projects API documentation](#create-project) for details about how to set custom default query settings.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
collection_ids (List[str]) – (optional) A comma-separated list of collection IDs to be queried against.
filter (str) – (optional) A cacheable query that excludes documents that don’t mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.
query (str) – (optional) A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.
natural_language_query (str) – (optional) A natural language query that returns relevant documents by utilizing training data and natural language understanding.
aggregation (str) – (optional) An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.
count (int) – (optional) Number of results to return.
return (List[str]) – (optional) A list of the fields in the document hierarchy to return. If this parameter not specified, then all top-level fields are returned.
offset (int) – (optional) The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.
sort (str) – (optional) A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified. This parameter cannot be used in the same query as the bias parameter.
highlight (bool) – (optional) When true, a highlight field is returned for each result which contains the fields which match the query with <em></em> tags around the matching query terms.
spelling_suggestions (bool) – (optional) When true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists).
table_results (QueryLargeTableResults) – (optional) Configuration for table retrieval.
suggested_refinements (QueryLargeSuggestedRefinements) – (optional) Configuration for suggested refinements.
passages (QueryLargePassages) – (optional) Configuration for passage retrieval.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
get_autocompletion
(project_id: str, prefix: str, *, collection_ids: List[str] = None, field: str = None, count: int = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Get Autocomplete Suggestions.
Returns completion query suggestions for the specified prefix.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
prefix (str) – The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to Hot, Housing, or How do I upgrade. Possible completions are.
collection_ids (List[str]) – (optional) Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.
field (str) – (optional) The field in the result documents that autocompletion suggestions are identified from.
count (int) – (optional) The number of autocompletion suggestions to return.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
query_notices
(project_id: str, *, filter: str = None, query: str = None, natural_language_query: str = None, count: int = None, offset: int = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Query system notices.
Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
filter (str) – (optional) A cacheable query that excludes documents that don’t mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.
query (str) – (optional) A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.
natural_language_query (str) – (optional) A natural language query that returns relevant documents by utilizing training data and natural language understanding.
count (int) – (optional) Number of results to return. The maximum for the count and offset values together in any one query is 10000.
offset (int) – (optional) The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
list_fields
(project_id: str, *, collection_ids: List[str] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List fields.
Gets a list of the unique fields (and their types) stored in the the specified collections.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
collection_ids (List[str]) – (optional) Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
get_component_settings
(project_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List component settings.
Returns default configuration settings for components.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
add_document
(project_id: str, collection_id: str, *, file: BinaryIO = None, filename: str = None, file_content_type: str = None, metadata: str = None, x_watson_discovery_force: bool = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Add a document.
- Add a document to a collection with optional metadata.
- Returns immediately after the system has accepted the document for processing.
The user must provide document content, metadata, or both. If the request is
- missing both document content and metadata, it is rejected.
The user can set the Content-Type parameter on the file part to
indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document’s media type.
The following field names are reserved and will be filtered out if present
after normalization: id, score, highlight, and any field with the prefix of: _, +, or -
Fields with empty name values after normalization are filtered out before
- indexing.
Fields containing the following characters after normalization are filtered
- out before indexing: # and ,
If the document is uploaded to a collection that has it’s data shared with
- another collection, the X-Watson-Discovery-Force header must be set to true.
Note: Documents can be added with a specific document_id by using the
_/v2/projects/{project_id}/collections/{collection_id}/documents method. Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
collection_id (str) – The ID of the collection.
file (TextIO) – (optional) The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.
filename (str) – (optional) The filename for file.
file_content_type (str) – (optional) The content type of file.
metadata (str) –
(optional) The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: ``` {
”Creator”: “Johnny Appleseed”, “Subject”: “Apples”
x_watson_discovery_force (bool) – (optional) When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
update_document
(project_id: str, collection_id: str, document_id: str, *, file: BinaryIO = None, filename: str = None, file_content_type: str = None, metadata: str = None, x_watson_discovery_force: bool = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Update a document.
Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata. If the document is uploaded to a collection that has it’s data shared with another collection, the X-Watson-Discovery-Force header must be set to true. Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists. Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint. Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
collection_id (str) – The ID of the collection.
document_id (str) – The ID of the document.
file (TextIO) – (optional) The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.
filename (str) – (optional) The filename for file.
file_content_type (str) – (optional) The content type of file.
metadata (str) –
(optional) The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: ``` {
”Creator”: “Johnny Appleseed”, “Subject”: “Apples”
x_watson_discovery_force (bool) – (optional) When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
delete_document
(project_id: str, collection_id: str, document_id: str, *, x_watson_discovery_force: bool = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete a document.
If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to ‘deleted’. Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint. Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
collection_id (str) – The ID of the collection.
document_id (str) – The ID of the document.
x_watson_discovery_force (bool) – (optional) When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
list_training_queries
(project_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List training queries.
List the training queries for the specified project.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
delete_training_queries
(project_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete training queries.
Removes all training queries for the specified project.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
create_training_query
(project_id: str, natural_language_query: str, examples: List[TrainingExample], *, filter: str = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Create training query.
Add a query to the training data for this project. The query can contain a filter and natural language query.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
natural_language_query (str) – The natural text query for the training query.
examples (List[TrainingExample]) – Array of training examples.
filter (str) – (optional) The filter used on the collection before the natural_language_query is applied.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
get_training_query
(project_id: str, query_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Get a training data query.
Get details for a specific training data query, including the query string and all examples.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
update_training_query
(project_id: str, query_id: str, natural_language_query: str, examples: List[TrainingExample], *, filter: str = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Update a training query.
Updates an existing training query and it’s examples.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
query_id (str) – The ID of the query used for training.
natural_language_query (str) – The natural text query for the training query.
examples (List[TrainingExample]) – Array of training examples.
filter (str) – (optional) The filter used on the collection before the natural_language_query is applied.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
analyze_document
(project_id: str, collection_id: str, *, file: BinaryIO = None, filename: str = None, file_content_type: str = None, metadata: str = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Analyze a Document.
Process a document using the specified collection’s settings and return it for realtime use. Note: Documents processed using this method are not added to the specified collection. Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
collection_id (str) – The ID of the collection.
file (TextIO) – (optional) The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.
filename (str) – (optional) The filename for file.
file_content_type (str) – (optional) The content type of file.
metadata (str) –
(optional) The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: ``` {
”Creator”: “Johnny Appleseed”, “Subject”: “Apples”
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
list_enrichments
(project_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List Enrichments.
List the enrichments available to this project.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
create_enrichment
(project_id: str, enrichment: ibm_watson.discovery_v2.CreateEnrichment, *, file: BinaryIO = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Create an enrichment.
Create an enrichment for use with the specified project/.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
enrichment (CreateEnrichment) –
file (TextIO) – (optional) The enrichment file to upload.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
get_enrichment
(project_id: str, enrichment_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Get enrichment.
Get details about a specific enrichment.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
update_enrichment
(project_id: str, enrichment_id: str, name: str, *, description: str = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Update an enrichment.
Updates an existing enrichment’s name and description.
- Parameters
project_id (str) – The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.
enrichment_id (str) – The ID of the enrichment.
name (str) – A new name for the enrichment.
description (str) – (optional) A new description for the enrichment.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
delete_enrichment
(project_id: str, enrichment_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete an enrichment.
Deletes an existing enrichment from the specified project. Note: Only enrichments that have been manually created can be deleted.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
list_projects
(**kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List projects.
Lists existing projects for this instance.
- Parameters
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
create_project
(name: str, type: str, *, default_query_parameters: Optional[ibm_watson.discovery_v2.DefaultQueryParams] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Create a Project.
Create a new project for this instance.
- Parameters
name (str) – The human readable name of this project.
type (str) – The project type of this project.
default_query_parameters (DefaultQueryParams) – (optional) Default query parameters for this project.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
get_project
(project_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Get project.
Get details on the specified project.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
update_project
(project_id: str, *, name: str = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Update a project.
Update the specified project’s name.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
delete_project
(project_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete a project.
Deletes the specified project. Important: Deleting a project deletes everything that is part of the specified project, including all collections.
- Parameters
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse
-
delete_user_data
(customer_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete labeled data.
Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID. You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see [Information security](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-information-security#information-security). Note: This method is only supported on IBM Cloud instances of Discovery.
-
-
class
AddDocumentEnums
[source]¶ Bases:
object
-
class
FileContentType
(value)[source]¶ Bases:
enum.Enum
The content type of file.
-
APPLICATION_JSON
= 'application/json'¶
-
APPLICATION_MSWORD
= 'application/msword'¶
-
APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT
= 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'¶
-
APPLICATION_PDF
= 'application/pdf'¶
-
TEXT_HTML
= 'text/html'¶
-
APPLICATION_XHTML_XML
= 'application/xhtml+xml'¶
-
-
class
-
class
UpdateDocumentEnums
[source]¶ Bases:
object
-
class
FileContentType
(value)[source]¶ Bases:
enum.Enum
The content type of file.
-
APPLICATION_JSON
= 'application/json'¶
-
APPLICATION_MSWORD
= 'application/msword'¶
-
APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT
= 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'¶
-
APPLICATION_PDF
= 'application/pdf'¶
-
TEXT_HTML
= 'text/html'¶
-
APPLICATION_XHTML_XML
= 'application/xhtml+xml'¶
-
-
class
-
class
AnalyzeDocumentEnums
[source]¶ Bases:
object
-
class
FileContentType
(value)[source]¶ Bases:
enum.Enum
The content type of file.
-
APPLICATION_JSON
= 'application/json'¶
-
APPLICATION_MSWORD
= 'application/msword'¶
-
APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT
= 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'¶
-
APPLICATION_PDF
= 'application/pdf'¶
-
TEXT_HTML
= 'text/html'¶
-
APPLICATION_XHTML_XML
= 'application/xhtml+xml'¶
-
-
class
-
class
AnalyzedDocument
(*, notices: List[Notice] = None, result: Optional[ibm_watson.discovery_v2.AnalyzedResult] = None)[source]¶ Bases:
object
An object containing the converted document and any identifed enrichments.
- Attr List[Notice] notices
(optional) Array of document results that match the query.
- Attr AnalyzedResult result
(optional) Result of the document analysis.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.AnalyzedDocument[source]¶ Initialize a AnalyzedDocument object from a json dictionary.
-
class
AnalyzedResult
(*, metadata: dict = None, **kwargs)[source]¶ Bases:
object
Result of the document analysis.
- Attr dict metadata
(optional) Metadata of the document.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.AnalyzedResult[source]¶ Initialize a AnalyzedResult object from a json dictionary.
-
class
Collection
(*, collection_id: str = None, name: str = None)[source]¶ Bases:
object
A collection for storing documents.
- Attr str collection_id
(optional) The unique identifier of the collection.
- Attr str name
(optional) The name of the collection.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.Collection[source]¶ Initialize a Collection object from a json dictionary.
-
class
CollectionDetails
(name: str, *, collection_id: str = None, description: str = None, created: datetime.datetime = None, language: str = None, enrichments: List[CollectionEnrichment] = None)[source]¶ Bases:
object
A collection for storing documents.
- Attr str collection_id
(optional) The unique identifier of the collection.
- Attr str name
The name of the collection.
- Attr str description
(optional) A description of the collection.
- Attr datetime created
(optional) The date that the collection was created.
- Attr str language
(optional) The language of the collection.
- Attr List[CollectionEnrichment] enrichments
(optional) An array of enrichments that are applied to this collection.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.CollectionDetails[source]¶ Initialize a CollectionDetails object from a json dictionary.
-
class
CollectionEnrichment
(*, enrichment_id: str = None, fields: List[str] = None)[source]¶ Bases:
object
An object describing an Enrichment for a collection.
- Attr str enrichment_id
(optional) The unique identifier of this enrichment.
- Attr List[str] fields
(optional) An array of field names that the enrichment is applied to.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.CollectionEnrichment[source]¶ Initialize a CollectionEnrichment object from a json dictionary.
-
class
Completions
(*, completions: List[str] = None)[source]¶ Bases:
object
An object containing an array of autocompletion suggestions.
- Attr List[str] completions
(optional) Array of autcomplete suggestion based on the provided prefix.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.Completions[source]¶ Initialize a Completions object from a json dictionary.
-
class
ComponentSettingsAggregation
(*, name: str = None, label: str = None, multiple_selections_allowed: bool = None, visualization_type: str = None)[source]¶ Bases:
object
Display settings for aggregations.
- Attr str name
(optional) Identifier used to map aggregation settings to aggregation configuration.
- Attr str label
(optional) User-friendly alias for the aggregation.
- Attr bool multiple_selections_allowed
(optional) Whether users is allowed to select more than one of the aggregation terms.
- Attr str visualization_type
(optional) Type of visualization to use when rendering the aggregation.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ComponentSettingsAggregation[source]¶ Initialize a ComponentSettingsAggregation object from a json dictionary.
-
class
ComponentSettingsFieldsShown
(*, body: Optional[ibm_watson.discovery_v2.ComponentSettingsFieldsShownBody] = None, title: Optional[ibm_watson.discovery_v2.ComponentSettingsFieldsShownTitle] = None)[source]¶ Bases:
object
Fields shown in the results section of the UI.
- Attr ComponentSettingsFieldsShownBody body
(optional) Body label.
- Attr ComponentSettingsFieldsShownTitle title
(optional) Title label.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ComponentSettingsFieldsShown[source]¶ Initialize a ComponentSettingsFieldsShown object from a json dictionary.
-
class
ComponentSettingsFieldsShownBody
(*, use_passage: bool = None, field: str = None)[source]¶ Bases:
object
Body label.
- Attr bool use_passage
(optional) Use the whole passage as the body.
- Attr str field
(optional) Use a specific field as the title.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ComponentSettingsFieldsShownBody[source]¶ Initialize a ComponentSettingsFieldsShownBody object from a json dictionary.
-
class
ComponentSettingsFieldsShownTitle
(*, field: str = None)[source]¶ Bases:
object
Title label.
- Attr str field
(optional) Use a specific field as the title.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ComponentSettingsFieldsShownTitle[source]¶ Initialize a ComponentSettingsFieldsShownTitle object from a json dictionary.
-
class
ComponentSettingsResponse
(*, fields_shown: Optional[ibm_watson.discovery_v2.ComponentSettingsFieldsShown] = None, autocomplete: bool = None, structured_search: bool = None, results_per_page: int = None, aggregations: List[ComponentSettingsAggregation] = None)[source]¶ Bases:
object
The default component settings for this project.
- Attr ComponentSettingsFieldsShown fields_shown
(optional) Fields shown in the results section of the UI.
- Attr bool autocomplete
(optional) Whether or not autocomplete is enabled.
- Attr bool structured_search
(optional) Whether or not structured search is enabled.
- Attr int results_per_page
(optional) Number or results shown per page.
- Attr List[ComponentSettingsAggregation] aggregations
(optional) a list of component setting aggregations.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ComponentSettingsResponse[source]¶ Initialize a ComponentSettingsResponse object from a json dictionary.
-
class
CreateEnrichment
(*, name: str = None, description: str = None, type: str = None, options: Optional[ibm_watson.discovery_v2.EnrichmentOptions] = None)[source]¶ Bases:
object
Information about a specific enrichment.
- Attr str name
(optional) The human readable name for this enrichment.
- Attr str description
(optional) The description of this enrichment.
- Attr str type
(optional) The type of this enrichment.
- Attr EnrichmentOptions options
(optional) A object containing options for the current enrichment.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.CreateEnrichment[source]¶ Initialize a CreateEnrichment object from a json dictionary.
-
class
DefaultQueryParams
(*, collection_ids: List[str] = None, passages: Optional[ibm_watson.discovery_v2.DefaultQueryParamsPassages] = None, table_results: Optional[ibm_watson.discovery_v2.DefaultQueryParamsTableResults] = None, aggregation: str = None, suggested_refinements: Optional[ibm_watson.discovery_v2.DefaultQueryParamsSuggestedRefinements] = None, spelling_suggestions: bool = None, highlight: bool = None, count: int = None, sort: str = None, return_: List[str] = None)[source]¶ Bases:
object
Default query parameters for this project.
- Attr List[str] collection_ids
(optional) An array of collection identifiers to query. If empty or omitted all collections in the project are queried.
- Attr DefaultQueryParamsPassages passages
(optional) Default settings configuration for passage search options.
- Attr DefaultQueryParamsTableResults table_results
(optional) Default project query settings for table results.
- Attr str aggregation
(optional) A string representing the default aggregation query for the project.
- Attr DefaultQueryParamsSuggestedRefinements suggested_refinements
(optional) Object containing suggested refinement settings.
- Attr bool spelling_suggestions
(optional) When true, a spelling suggestions for the query are retuned by default.
- Attr bool highlight
(optional) When true, a highlights for the query are retuned by default.
- Attr int count
(optional) The number of document results returned by default.
- Attr str sort
(optional) A comma separated list of document fields to sort results by default.
- Attr List[str] returnreturn_
(optional) An array of field names to return in document results if present by default.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.DefaultQueryParams[source]¶ Initialize a DefaultQueryParams object from a json dictionary.
-
class
DefaultQueryParamsPassages
(*, enabled: bool = None, count: int = None, fields: List[str] = None, characters: int = None, per_document: bool = None, max_per_document: int = None)[source]¶ Bases:
object
Default settings configuration for passage search options.
- Attr bool enabled
(optional) When true, a passage search is performed by default.
- Attr int count
(optional) The number of passages to return.
- Attr List[str] fields
(optional) An array of field names to perfom the passage search on.
- Attr int characters
(optional) The approximate number of characters that each returned passage will contain.
- Attr bool per_document
(optional) When true the number of passages that can be returned from a single document is restricted to the max_per_document value.
- Attr int max_per_document
(optional) The default maximum number of passages that can be taken from a single document as the result of a passage query.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.DefaultQueryParamsPassages[source]¶ Initialize a DefaultQueryParamsPassages object from a json dictionary.
-
class
DefaultQueryParamsSuggestedRefinements
(*, enabled: bool = None, count: int = None)[source]¶ Bases:
object
Object containing suggested refinement settings.
- Attr bool enabled
(optional) When true, a suggested refinements for the query are retuned by default.
- Attr int count
(optional) The number of suggested refinements to return by default.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.DefaultQueryParamsSuggestedRefinements[source]¶ Initialize a DefaultQueryParamsSuggestedRefinements object from a json dictionary.
-
class
DefaultQueryParamsTableResults
(*, enabled: bool = None, count: int = None, per_document: int = None)[source]¶ Bases:
object
Default project query settings for table results.
- Attr bool enabled
(optional) When true, a table results for the query are retuned by default.
- Attr int count
(optional) The number of table results to return by default.
- Attr int per_document
(optional) The number of table results to include in each result document.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.DefaultQueryParamsTableResults[source]¶ Initialize a DefaultQueryParamsTableResults object from a json dictionary.
-
class
DeleteDocumentResponse
(*, document_id: str = None, status: str = None)[source]¶ Bases:
object
Information returned when a document is deleted.
- Attr str document_id
(optional) The unique identifier of the document.
- Attr str status
(optional) Status of the document. A deleted document has the status deleted.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.DeleteDocumentResponse[source]¶ Initialize a DeleteDocumentResponse object from a json dictionary.
-
class
DocumentAccepted
(*, document_id: str = None, status: str = None)[source]¶ Bases:
object
Information returned after an uploaded document is accepted.
- Attr str document_id
(optional) The unique identifier of the ingested document.
- Attr str status
(optional) Status of the document in the ingestion process. A status of processing is returned for documents that are ingested with a version date before 2019-01-01. The pending status is returned for all others.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.DocumentAccepted[source]¶ Initialize a DocumentAccepted object from a json dictionary.
-
class
DocumentAttribute
(*, type: str = None, text: str = None, location: Optional[ibm_watson.discovery_v2.TableElementLocation] = None)[source]¶ Bases:
object
List of document attributes.
- Attr str type
(optional) The type of attribute.
- Attr str text
(optional) The text associated with the attribute.
- Attr TableElementLocation location
(optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.DocumentAttribute[source]¶ Initialize a DocumentAttribute object from a json dictionary.
-
class
Enrichment
(*, enrichment_id: str = None, name: str = None, description: str = None, type: str = None, options: Optional[ibm_watson.discovery_v2.EnrichmentOptions] = None)[source]¶ Bases:
object
Information about a specific enrichment.
- Attr str enrichment_id
(optional) The unique identifier of this enrichment.
- Attr str name
(optional) The human readable name for this enrichment.
- Attr str description
(optional) The description of this enrichment.
- Attr str type
(optional) The type of this enrichment.
- Attr EnrichmentOptions options
(optional) A object containing options for the current enrichment.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.Enrichment[source]¶ Initialize a Enrichment object from a json dictionary.
-
class
TypeEnum
(value)[source]¶ Bases:
enum.Enum
The type of this enrichment.
-
PART_OF_SPEECH
= 'part_of_speech'¶
-
SENTIMENT
= 'sentiment'¶
-
NATURAL_LANGUAGE_UNDERSTANDING
= 'natural_language_understanding'¶
-
DICTIONARY
= 'dictionary'¶
-
REGULAR_EXPRESSION
= 'regular_expression'¶
-
UIMA_ANNOTATOR
= 'uima_annotator'¶
-
RULE_BASED
= 'rule_based'¶
-
WATSON_KNOWLEDGE_STUDIO_MODEL
= 'watson_knowledge_studio_model'¶
-
-
class
EnrichmentOptions
(*, languages: List[str] = None, entity_type: str = None, regular_expression: str = None, result_field: str = None)[source]¶ Bases:
object
A object containing options for the current enrichment.
- Attr List[str] languages
(optional) An array of supported languages for this enrichment.
- Attr str entity_type
(optional) The type of entity. Required when creating dictionary and regular_expression type enrichment. Not valid when creating any other type of enrichment.
- Attr str regular_expression
(optional) The regular expression to apply for this enrichment. Required only when the type of enrichment being created is a regular_expression. Not valid when creating any other type of enrichment.
- Attr str result_field
(optional) The name of the result document field that this enrichment creates. Required only when the enrichment type is rule_based. Not valid when creating any other type of enrichment.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.EnrichmentOptions[source]¶ Initialize a EnrichmentOptions object from a json dictionary.
-
class
Enrichments
(*, enrichments: List[Enrichment] = None)[source]¶ Bases:
object
An object containing an array of enrichment definitions.
- Attr List[Enrichment] enrichments
(optional) An array of enrichment definitions.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.Enrichments[source]¶ Initialize a Enrichments object from a json dictionary.
-
class
Field
(*, field: str = None, type: str = None, collection_id: str = None)[source]¶ Bases:
object
Object containing field details.
- Attr str field
(optional) The name of the field.
- Attr str type
(optional) The type of the field.
- Attr str collection_id
(optional) The collection Id of the collection where the field was found.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.Field[source]¶ Initialize a Field object from a json dictionary.
-
class
ListCollectionsResponse
(*, collections: List[Collection] = None)[source]¶ Bases:
object
Response object containing an array of collection details.
- Attr List[Collection] collections
(optional) An array containing information about each collection in the project.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ListCollectionsResponse[source]¶ Initialize a ListCollectionsResponse object from a json dictionary.
-
class
ListFieldsResponse
(*, fields: List[Field] = None)[source]¶ Bases:
object
The list of fetched fields. The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.
Fields which contain nested objects are assigned a type of “nested”.
Fields which belong to a nested object are prefixed with .properties (for
example, warnings.properties.severity means that the warnings object has a property called severity).
- Attr List[Field] fields
(optional) An array containing information about each field in the collections.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ListFieldsResponse[source]¶ Initialize a ListFieldsResponse object from a json dictionary.
-
class
ListProjectsResponse
(*, projects: List[ProjectListDetails] = None)[source]¶ Bases:
object
A list of projects in this instance.
- Attr List[ProjectListDetails] projects
(optional) An array of project details.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ListProjectsResponse[source]¶ Initialize a ListProjectsResponse object from a json dictionary.
-
class
Notice
(*, notice_id: str = None, created: datetime.datetime = None, document_id: str = None, collection_id: str = None, query_id: str = None, severity: str = None, step: str = None, description: str = None)[source]¶ Bases:
object
A notice produced for the collection.
- Attr str notice_id
(optional) Identifies the notice. Many notices might have the same ID. This field exists so that user applications can programmatically identify a notice and take automatic corrective action. Typical notice IDs include: index_failed, index_failed_too_many_requests, index_failed_incompatible_field, index_failed_cluster_unavailable, ingestion_timeout, ingestion_error, bad_request, internal_error, missing_model, unsupported_model, smart_document_understanding_failed_incompatible_field, smart_document_understanding_failed_internal_error, smart_document_understanding_failed_internal_error, smart_document_understanding_failed_warning, smart_document_understanding_page_error, smart_document_understanding_page_warning. Note: This is not a complete list, other values might be returned.
- Attr datetime created
(optional) The creation date of the collection in the format yyyy-MM-dd’T’HH:mm:ss.SSS’Z’.
- Attr str document_id
(optional) Unique identifier of the document.
- Attr str collection_id
(optional) Unique identifier of the collection.
- Attr str query_id
(optional) Unique identifier of the query used for relevance training.
- Attr str severity
(optional) Severity level of the notice.
- Attr str step
(optional) Ingestion or training step in which the notice occurred.
- Attr str description
(optional) The description of the notice.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.Notice[source]¶ Initialize a Notice object from a json dictionary.
-
class
ProjectDetails
(*, project_id: str = None, name: str = None, type: str = None, relevancy_training_status: Optional[ibm_watson.discovery_v2.ProjectListDetailsRelevancyTrainingStatus] = None, collection_count: int = None, default_query_parameters: Optional[ibm_watson.discovery_v2.DefaultQueryParams] = None)[source]¶ Bases:
object
Detailed information about the specified project.
- Attr str project_id
(optional) The unique identifier of this project.
- Attr str name
(optional) The human readable name of this project.
- Attr str type
(optional) The project type of this project.
- Attr ProjectListDetailsRelevancyTrainingStatus relevancy_training_status
(optional) Relevancy training status information for this project.
- Attr int collection_count
(optional) The number of collections configured in this project.
- Attr DefaultQueryParams default_query_parameters
(optional) Default query parameters for this project.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ProjectDetails[source]¶ Initialize a ProjectDetails object from a json dictionary.
-
class
ProjectListDetails
(*, project_id: str = None, name: str = None, type: str = None, relevancy_training_status: Optional[ibm_watson.discovery_v2.ProjectListDetailsRelevancyTrainingStatus] = None, collection_count: int = None)[source]¶ Bases:
object
Details about a specific project.
- Attr str project_id
(optional) The unique identifier of this project.
- Attr str name
(optional) The human readable name of this project.
- Attr str type
(optional) The project type of this project.
- Attr ProjectListDetailsRelevancyTrainingStatus relevancy_training_status
(optional) Relevancy training status information for this project.
- Attr int collection_count
(optional) The number of collections configured in this project.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ProjectListDetails[source]¶ Initialize a ProjectListDetails object from a json dictionary.
-
class
ProjectListDetailsRelevancyTrainingStatus
(*, data_updated: str = None, total_examples: int = None, sufficient_label_diversity: bool = None, processing: bool = None, minimum_examples_added: bool = None, successfully_trained: str = None, available: bool = None, notices: int = None, minimum_queries_added: bool = None)[source]¶ Bases:
object
Relevancy training status information for this project.
- Attr str data_updated
(optional) When the training data was updated.
- Attr int total_examples
(optional) The total number of examples.
- Attr bool sufficient_label_diversity
(optional) When true, sufficent label diversity is present to allow training for this project.
- Attr bool processing
(optional) When true, the relevancy training is in processing.
- Attr bool minimum_examples_added
(optional) When true, the minimum number of examples required to train has been met.
- Attr str successfully_trained
(optional) The time that the most recent successful training occured.
- Attr bool available
(optional) When true, relevancy training is available when querying collections in the project.
- Attr int notices
(optional) The number of notices generated during the relevancy training.
- Attr bool minimum_queries_added
(optional) When true, the minimum number of queries required to train has been met.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.ProjectListDetailsRelevancyTrainingStatus[source]¶ Initialize a ProjectListDetailsRelevancyTrainingStatus object from a json dictionary.
-
class
QueryAggregation
(type: str)[source]¶ Bases:
object
An abstract aggregation type produced by Discovery to analyze the input provided.
- Attr str type
The type of aggregation command used. Options include: term, histogram, timeslice, nested, filter, min, max, sum, average, unique_count, and top_hits.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryAggregation[source]¶ Initialize a QueryAggregation object from a json dictionary.
-
class
QueryGroupByAggregationResult
(key: str, matching_results: int, *, relevancy: float = None, total_matching_documents: int = None, estimated_matching_documents: int = None, aggregations: List[QueryAggregation] = None)[source]¶ Bases:
object
Top value result for the term aggregation.
- Attr str key
Value of the field with a non-zero frequency in the document set.
- Attr int matching_results
Number of documents containing the ‘key’.
- Attr float relevancy
(optional) The relevancy for this group.
- Attr int total_matching_documents
(optional) The number of documents which have the group as the value of specified field in the whole set of documents in this collection. Returned only when the relevancy parameter is set to true.
- Attr int estimated_matching_documents
(optional) The estimated number of documents which would match the query and also meet the condition. Returned only when the relevancy parameter is set to true.
- Attr List[QueryAggregation] aggregations
(optional) An array of sub aggregations.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryGroupByAggregationResult[source]¶ Initialize a QueryGroupByAggregationResult object from a json dictionary.
-
class
QueryHistogramAggregationResult
(key: int, matching_results: int, *, aggregations: List[QueryAggregation] = None)[source]¶ Bases:
object
Histogram numeric interval result.
- Attr int key
The value of the upper bound for the numeric segment.
- Attr int matching_results
Number of documents with the specified key as the upper bound.
- Attr List[QueryAggregation] aggregations
(optional) An array of sub aggregations.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryHistogramAggregationResult[source]¶ Initialize a QueryHistogramAggregationResult object from a json dictionary.
-
class
QueryLargePassages
(*, enabled: bool = None, per_document: bool = None, max_per_document: int = None, fields: List[str] = None, count: int = None, characters: int = None)[source]¶ Bases:
object
Configuration for passage retrieval.
- Attr bool enabled
(optional) A passages query that returns the most relevant passages from the results.
- Attr bool per_document
(optional) When true, passages will be returned within their respective result.
- Attr int max_per_document
(optional) Maximum number of passages to return per result.
- Attr List[str] fields
(optional) A list of fields that passages are drawn from. If this parameter not specified, then all top-level fields are included.
- Attr int count
(optional) The maximum number of passages to return. The search returns fewer passages if the requested total is not found. The maximum is 100.
- Attr int characters
(optional) The approximate number of characters that any one passage will have.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryLargePassages[source]¶ Initialize a QueryLargePassages object from a json dictionary.
-
class
QueryLargeSuggestedRefinements
(*, enabled: bool = None, count: int = None)[source]¶ Bases:
object
Configuration for suggested refinements.
- Attr bool enabled
(optional) Whether to perform suggested refinements.
- Attr int count
(optional) Maximum number of suggested refinements texts to be returned. The maximum is 100.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryLargeSuggestedRefinements[source]¶ Initialize a QueryLargeSuggestedRefinements object from a json dictionary.
-
class
QueryLargeTableResults
(*, enabled: bool = None, count: int = None)[source]¶ Bases:
object
Configuration for table retrieval.
- Attr bool enabled
(optional) Whether to enable table retrieval.
- Attr int count
(optional) Maximum number of tables to return.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryLargeTableResults[source]¶ Initialize a QueryLargeTableResults object from a json dictionary.
-
class
QueryNoticesResponse
(*, matching_results: int = None, notices: List[Notice] = None)[source]¶ Bases:
object
Object containing notice query results.
- Attr int matching_results
(optional) The number of matching results.
- Attr List[Notice] notices
(optional) Array of document results that match the query.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryNoticesResponse[source]¶ Initialize a QueryNoticesResponse object from a json dictionary.
-
class
QueryResponse
(*, matching_results: int = None, results: List[QueryResult] = None, aggregations: List[QueryAggregation] = None, retrieval_details: Optional[ibm_watson.discovery_v2.RetrievalDetails] = None, suggested_query: str = None, suggested_refinements: List[QuerySuggestedRefinement] = None, table_results: List[QueryTableResult] = None)[source]¶ Bases:
object
A response containing the documents and aggregations for the query.
- Attr int matching_results
(optional) The number of matching results for the query.
- Attr List[QueryResult] results
(optional) Array of document results for the query.
- Attr List[QueryAggregation] aggregations
(optional) Array of aggregations for the query.
- Attr RetrievalDetails retrieval_details
(optional) An object contain retrieval type information.
- Attr str suggested_query
(optional) Suggested correction to the submitted natural_language_query value.
- Attr List[QuerySuggestedRefinement] suggested_refinements
(optional) Array of suggested refinements.
- Attr List[QueryTableResult] table_results
(optional) Array of table results.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryResponse[source]¶ Initialize a QueryResponse object from a json dictionary.
-
class
QueryResult
(document_id: str, result_metadata: ibm_watson.discovery_v2.QueryResultMetadata, *, metadata: dict = None, document_passages: List[QueryResultPassage] = None, **kwargs)[source]¶ Bases:
object
Result document for the specified query.
- Attr str document_id
The unique identifier of the document.
- Attr dict metadata
(optional) Metadata of the document.
- Attr QueryResultMetadata result_metadata
Metadata of a query result.
- Attr List[QueryResultPassage] document_passages
(optional) Passages returned by Discovery.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryResult[source]¶ Initialize a QueryResult object from a json dictionary.
-
class
QueryResultMetadata
(collection_id: str, *, document_retrieval_source: str = None, confidence: float = None)[source]¶ Bases:
object
Metadata of a query result.
- Attr str document_retrieval_source
(optional) The document retrieval source that produced this search result.
- Attr str collection_id
The collection id associated with this training data set.
- Attr float confidence
(optional) The confidence score for the given result. Calculated based on how relevant the result is estimated to be. confidence can range from 0.0 to 1.0. The higher the number, the more relevant the document. The confidence value for a result was calculated using the model specified in the document_retrieval_strategy field of the result set. This field is only returned if the natural_language_query parameter is specified in the query.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryResultMetadata[source]¶ Initialize a QueryResultMetadata object from a json dictionary.
-
class
QueryResultPassage
(*, passage_text: str = None, start_offset: int = None, end_offset: int = None, field: str = None)[source]¶ Bases:
object
A passage query result.
- Attr str passage_text
(optional) The content of the extracted passage.
- Attr int start_offset
(optional) The position of the first character of the extracted passage in the originating field.
- Attr int end_offset
(optional) The position of the last character of the extracted passage in the originating field.
- Attr str field
(optional) The label of the field from which the passage has been extracted.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryResultPassage[source]¶ Initialize a QueryResultPassage object from a json dictionary.
-
class
QuerySuggestedRefinement
(*, text: str = None)[source]¶ Bases:
object
A suggested additional query term or terms user to filter results.
- Attr str text
(optional) The text used to filter.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QuerySuggestedRefinement[source]¶ Initialize a QuerySuggestedRefinement object from a json dictionary.
-
class
QueryTableResult
(*, table_id: str = None, source_document_id: str = None, collection_id: str = None, table_html: str = None, table_html_offset: int = None, table: Optional[ibm_watson.discovery_v2.TableResultTable] = None)[source]¶ Bases:
object
A tables whose content or context match a search query.
- Attr str table_id
(optional) The identifier for the retrieved table.
- Attr str source_document_id
(optional) The identifier of the document the table was retrieved from.
- Attr str collection_id
(optional) The identifier of the collection the table was retrieved from.
- Attr str table_html
(optional) HTML snippet of the table info.
- Attr int table_html_offset
(optional) The offset of the table html snippet in the original document html.
- Attr TableResultTable table
(optional) Full table object retrieved from Table Understanding Enrichment.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryTableResult[source]¶ Initialize a QueryTableResult object from a json dictionary.
-
class
QueryTermAggregationResult
(key: str, matching_results: int, *, relevancy: float = None, total_matching_documents: int = None, estimated_matching_documents: int = None, aggregations: List[QueryAggregation] = None)[source]¶ Bases:
object
Top value result for the term aggregation.
- Attr str key
Value of the field with a non-zero frequency in the document set.
- Attr int matching_results
Number of documents containing the ‘key’.
- Attr float relevancy
(optional) The relevancy for this term.
- Attr int total_matching_documents
(optional) The number of documents which have the term as the value of specified field in the whole set of documents in this collection. Returned only when the relevancy parameter is set to true.
- Attr int estimated_matching_documents
(optional) The estimated number of documents which would match the query and also meet the condition. Returned only when the relevancy parameter is set to true.
- Attr List[QueryAggregation] aggregations
(optional) An array of sub aggregations.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryTermAggregationResult[source]¶ Initialize a QueryTermAggregationResult object from a json dictionary.
-
class
QueryTimesliceAggregationResult
(key_as_string: str, key: int, matching_results: int, *, aggregations: List[QueryAggregation] = None)[source]¶ Bases:
object
A timeslice interval segment.
- Attr str key_as_string
String date value of the upper bound for the timeslice interval in ISO-8601 format.
- Attr int key
Numeric date value of the upper bound for the timeslice interval in UNIX milliseconds since epoch.
- Attr int matching_results
Number of documents with the specified key as the upper bound.
- Attr List[QueryAggregation] aggregations
(optional) An array of sub aggregations.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryTimesliceAggregationResult[source]¶ Initialize a QueryTimesliceAggregationResult object from a json dictionary.
-
class
QueryTopHitsAggregationResult
(matching_results: int, *, hits: List[dict] = None)[source]¶ Bases:
object
A query response containing the matching documents for the preceding aggregations.
- Attr int matching_results
Number of matching results.
- Attr List[dict] hits
(optional) An array of the document results.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryTopHitsAggregationResult[source]¶ Initialize a QueryTopHitsAggregationResult object from a json dictionary.
-
class
RetrievalDetails
(*, document_retrieval_strategy: str = None)[source]¶ Bases:
object
An object contain retrieval type information.
- Attr str document_retrieval_strategy
(optional) Identifies the document retrieval strategy used for this query. relevancy_training indicates that the results were returned using a relevancy trained model.
Note: In the event of trained collections being queried, but the trained
model is not used to return results, the document_retrieval_strategy will be listed as untrained.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.RetrievalDetails[source]¶ Initialize a RetrievalDetails object from a json dictionary.
-
class
DocumentRetrievalStrategyEnum
(value)[source]¶ Bases:
enum.Enum
Identifies the document retrieval strategy used for this query. relevancy_training indicates that the results were returned using a relevancy trained model.
Note: In the event of trained collections being queried, but the trained
model is not used to return results, the document_retrieval_strategy will be listed as untrained.
-
UNTRAINED
= 'untrained'¶
-
RELEVANCY_TRAINING
= 'relevancy_training'¶
-
-
class
TableBodyCells
(*, cell_id: str = None, location: Optional[ibm_watson.discovery_v2.TableElementLocation] = None, text: str = None, row_index_begin: int = None, row_index_end: int = None, column_index_begin: int = None, column_index_end: int = None, row_header_ids: List[TableRowHeaderIds] = None, row_header_texts: List[TableRowHeaderTexts] = None, row_header_texts_normalized: List[TableRowHeaderTextsNormalized] = None, column_header_ids: List[TableColumnHeaderIds] = None, column_header_texts: List[TableColumnHeaderTexts] = None, column_header_texts_normalized: List[TableColumnHeaderTextsNormalized] = None, attributes: List[DocumentAttribute] = None)[source]¶ Bases:
object
Cells that are not table header, column header, or row header cells.
- Attr str cell_id
(optional) The unique ID of the cell in the current table.
- Attr TableElementLocation location
(optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.
- Attr str text
(optional) The textual contents of this cell from the input document without associated markup content.
- Attr int row_index_begin
(optional) The begin index of this cell’s row location in the current table.
- Attr int row_index_end
(optional) The end index of this cell’s row location in the current table.
- Attr int column_index_begin
(optional) The begin index of this cell’s column location in the current table.
- Attr int column_index_end
(optional) The end index of this cell’s column location in the current table.
- Attr List[TableRowHeaderIds] row_header_ids
(optional) A list of table row header ids.
- Attr List[TableRowHeaderTexts] row_header_texts
(optional) A list of table row header texts.
- Attr List[TableRowHeaderTextsNormalized] row_header_texts_normalized
(optional) A list of table row header texts normalized.
- Attr List[TableColumnHeaderIds] column_header_ids
(optional) A list of table column header ids.
- Attr List[TableColumnHeaderTexts] column_header_texts
(optional) A list of table column header texts.
- Attr List[TableColumnHeaderTextsNormalized] column_header_texts_normalized
(optional) A list of table column header texts normalized.
- Attr List[DocumentAttribute] attributes
(optional) A list of document attributes.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableBodyCells[source]¶ Initialize a TableBodyCells object from a json dictionary.
-
class
TableCellKey
(*, cell_id: str = None, location: Optional[ibm_watson.discovery_v2.TableElementLocation] = None, text: str = None)[source]¶ Bases:
object
A key in a key-value pair.
- Attr str cell_id
(optional) The unique ID of the key in the table.
- Attr TableElementLocation location
(optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.
- Attr str text
(optional) The text content of the table cell without HTML markup.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableCellKey[source]¶ Initialize a TableCellKey object from a json dictionary.
-
class
TableCellValues
(*, cell_id: str = None, location: Optional[ibm_watson.discovery_v2.TableElementLocation] = None, text: str = None)[source]¶ Bases:
object
A value in a key-value pair.
- Attr str cell_id
(optional) The unique ID of the value in the table.
- Attr TableElementLocation location
(optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.
- Attr str text
(optional) The text content of the table cell without HTML markup.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableCellValues[source]¶ Initialize a TableCellValues object from a json dictionary.
-
class
TableColumnHeaderIds
(*, id: str = None)[source]¶ Bases:
object
An array of values, each being the id value of a column header that is applicable to the current cell.
- Attr str id
(optional) The id value of a column header.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableColumnHeaderIds[source]¶ Initialize a TableColumnHeaderIds object from a json dictionary.
-
class
TableColumnHeaderTexts
(*, text: str = None)[source]¶ Bases:
object
An array of values, each being the text value of a column header that is applicable to the current cell.
- Attr str text
(optional) The text value of a column header.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableColumnHeaderTexts[source]¶ Initialize a TableColumnHeaderTexts object from a json dictionary.
-
class
TableColumnHeaderTextsNormalized
(*, text_normalized: str = None)[source]¶ Bases:
object
If you provide customization input, the normalized version of the column header texts according to the customization; otherwise, the same value as column_header_texts.
- Attr str text_normalized
(optional) The normalized version of a column header text.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableColumnHeaderTextsNormalized[source]¶ Initialize a TableColumnHeaderTextsNormalized object from a json dictionary.
-
class
TableColumnHeaders
(*, cell_id: str = None, location: object = None, text: str = None, text_normalized: str = None, row_index_begin: int = None, row_index_end: int = None, column_index_begin: int = None, column_index_end: int = None)[source]¶ Bases:
object
Column-level cells, each applicable as a header to other cells in the same column as itself, of the current table.
- Attr str cell_id
(optional) The unique ID of the cell in the current table.
- Attr object location
(optional) The location of the column header cell in the current table as defined by its begin and end offsets, respectfully, in the input document.
- Attr str text
(optional) The textual contents of this cell from the input document without associated markup content.
- Attr str text_normalized
(optional) If you provide customization input, the normalized version of the cell text according to the customization; otherwise, the same value as text.
- Attr int row_index_begin
(optional) The begin index of this cell’s row location in the current table.
- Attr int row_index_end
(optional) The end index of this cell’s row location in the current table.
- Attr int column_index_begin
(optional) The begin index of this cell’s column location in the current table.
- Attr int column_index_end
(optional) The end index of this cell’s column location in the current table.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableColumnHeaders[source]¶ Initialize a TableColumnHeaders object from a json dictionary.
-
class
TableElementLocation
(begin: int, end: int)[source]¶ Bases:
object
The numeric location of the identified element in the document, represented with two integers labeled begin and end.
- Attr int begin
The element’s begin index.
- Attr int end
The element’s end index.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableElementLocation[source]¶ Initialize a TableElementLocation object from a json dictionary.
-
class
TableHeaders
(*, cell_id: str = None, location: object = None, text: str = None, row_index_begin: int = None, row_index_end: int = None, column_index_begin: int = None, column_index_end: int = None)[source]¶ Bases:
object
The contents of the current table’s header.
- Attr str cell_id
(optional) The unique ID of the cell in the current table.
- Attr object location
(optional) The location of the table header cell in the current table as defined by its begin and end offsets, respectfully, in the input document.
- Attr str text
(optional) The textual contents of the cell from the input document without associated markup content.
- Attr int row_index_begin
(optional) The begin index of this cell’s row location in the current table.
- Attr int row_index_end
(optional) The end index of this cell’s row location in the current table.
- Attr int column_index_begin
(optional) The begin index of this cell’s column location in the current table.
- Attr int column_index_end
(optional) The end index of this cell’s column location in the current table.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableHeaders[source]¶ Initialize a TableHeaders object from a json dictionary.
-
class
TableKeyValuePairs
(*, key: Optional[ibm_watson.discovery_v2.TableCellKey] = None, value: List[TableCellValues] = None)[source]¶ Bases:
object
Key-value pairs detected across cell boundaries.
- Attr TableCellKey key
(optional) A key in a key-value pair.
- Attr List[TableCellValues] value
(optional) A list of values in a key-value pair.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableKeyValuePairs[source]¶ Initialize a TableKeyValuePairs object from a json dictionary.
-
class
TableResultTable
(*, location: Optional[ibm_watson.discovery_v2.TableElementLocation] = None, text: str = None, section_title: Optional[ibm_watson.discovery_v2.TableTextLocation] = None, title: Optional[ibm_watson.discovery_v2.TableTextLocation] = None, table_headers: List[TableHeaders] = None, row_headers: List[TableRowHeaders] = None, column_headers: List[TableColumnHeaders] = None, key_value_pairs: List[TableKeyValuePairs] = None, body_cells: List[TableBodyCells] = None, contexts: List[TableTextLocation] = None)[source]¶ Bases:
object
Full table object retrieved from Table Understanding Enrichment.
- Attr TableElementLocation location
(optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.
- Attr str text
(optional) The textual contents of the current table from the input document without associated markup content.
- Attr TableTextLocation section_title
(optional) Text and associated location within a table.
- Attr TableTextLocation title
(optional) Text and associated location within a table.
- Attr List[TableHeaders] table_headers
(optional) An array of table-level cells that apply as headers to all the other cells in the current table.
- Attr List[TableRowHeaders] row_headers
(optional) An array of row-level cells, each applicable as a header to other cells in the same row as itself, of the current table.
- Attr List[TableColumnHeaders] column_headers
(optional) An array of column-level cells, each applicable as a header to other cells in the same column as itself, of the current table.
- Attr List[TableKeyValuePairs] key_value_pairs
(optional) An array of key-value pairs identified in the current table.
- Attr List[TableBodyCells] body_cells
(optional) An array of cells that are neither table header nor column header nor row header cells, of the current table with corresponding row and column header associations.
- Attr List[TableTextLocation] contexts
(optional) An array of lists of textual entries across the document related to the current table being parsed.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableResultTable[source]¶ Initialize a TableResultTable object from a json dictionary.
-
class
TableRowHeaderIds
(*, id: str = None)[source]¶ Bases:
object
An array of values, each being the id value of a row header that is applicable to this body cell.
- Attr str id
(optional) The id values of a row header.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableRowHeaderIds[source]¶ Initialize a TableRowHeaderIds object from a json dictionary.
-
class
TableRowHeaderTexts
(*, text: str = None)[source]¶ Bases:
object
An array of values, each being the text value of a row header that is applicable to this body cell.
- Attr str text
(optional) The text value of a row header.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableRowHeaderTexts[source]¶ Initialize a TableRowHeaderTexts object from a json dictionary.
-
class
TableRowHeaderTextsNormalized
(*, text_normalized: str = None)[source]¶ Bases:
object
If you provide customization input, the normalized version of the row header texts according to the customization; otherwise, the same value as row_header_texts.
- Attr str text_normalized
(optional) The normalized version of a row header text.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableRowHeaderTextsNormalized[source]¶ Initialize a TableRowHeaderTextsNormalized object from a json dictionary.
-
class
TableRowHeaders
(*, cell_id: str = None, location: Optional[ibm_watson.discovery_v2.TableElementLocation] = None, text: str = None, text_normalized: str = None, row_index_begin: int = None, row_index_end: int = None, column_index_begin: int = None, column_index_end: int = None)[source]¶ Bases:
object
Row-level cells, each applicable as a header to other cells in the same row as itself, of the current table.
- Attr str cell_id
(optional) The unique ID of the cell in the current table.
- Attr TableElementLocation location
(optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.
- Attr str text
(optional) The textual contents of this cell from the input document without associated markup content.
- Attr str text_normalized
(optional) If you provide customization input, the normalized version of the cell text according to the customization; otherwise, the same value as text.
- Attr int row_index_begin
(optional) The begin index of this cell’s row location in the current table.
- Attr int row_index_end
(optional) The end index of this cell’s row location in the current table.
- Attr int column_index_begin
(optional) The begin index of this cell’s column location in the current table.
- Attr int column_index_end
(optional) The end index of this cell’s column location in the current table.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableRowHeaders[source]¶ Initialize a TableRowHeaders object from a json dictionary.
-
class
TableTextLocation
(*, text: str = None, location: Optional[ibm_watson.discovery_v2.TableElementLocation] = None)[source]¶ Bases:
object
Text and associated location within a table.
- Attr str text
(optional) The text retrieved.
- Attr TableElementLocation location
(optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TableTextLocation[source]¶ Initialize a TableTextLocation object from a json dictionary.
-
class
TrainingExample
(document_id: str, collection_id: str, relevance: int, *, created: datetime.datetime = None, updated: datetime.datetime = None)[source]¶ Bases:
object
Object containing example response details for a training query.
- Attr str document_id
The document ID associated with this training example.
- Attr str collection_id
The collection ID associated with this training example.
- Attr int relevance
The relevance of the training example.
- Attr datetime created
(optional) The date and time the example was created.
- Attr datetime updated
(optional) The date and time the example was updated.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TrainingExample[source]¶ Initialize a TrainingExample object from a json dictionary.
-
class
TrainingQuery
(natural_language_query: str, examples: List[TrainingExample], *, query_id: str = None, filter: str = None, created: datetime.datetime = None, updated: datetime.datetime = None)[source]¶ Bases:
object
Object containing training query details.
- Attr str query_id
(optional) The query ID associated with the training query.
- Attr str natural_language_query
The natural text query for the training query.
- Attr str filter
(optional) The filter used on the collection before the natural_language_query is applied.
- Attr datetime created
(optional) The date and time the query was created.
- Attr datetime updated
(optional) The date and time the query was updated.
- Attr List[TrainingExample] examples
Array of training examples.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TrainingQuery[source]¶ Initialize a TrainingQuery object from a json dictionary.
-
class
TrainingQuerySet
(*, queries: List[TrainingQuery] = None)[source]¶ Bases:
object
Object specifying the training queries contained in the identified training set.
- Attr List[TrainingQuery] queries
(optional) Array of training queries.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.TrainingQuerySet[source]¶ Initialize a TrainingQuerySet object from a json dictionary.
-
class
QueryCalculationAggregation
(type: str, field: str, *, value: float = None)[source]¶ Bases:
ibm_watson.discovery_v2.QueryAggregation
Returns a scalar calculation across all documents for the field specified. Possible calculations include min, max, sum, average, and unique_count.
- Attr str field
The field to perform the calculation on.
- Attr float value
(optional) The value of the calculation.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryCalculationAggregation[source]¶ Initialize a QueryCalculationAggregation object from a json dictionary.
-
class
QueryFilterAggregation
(type: str, match: str, matching_results: int, *, aggregations: List[QueryAggregation] = None)[source]¶ Bases:
ibm_watson.discovery_v2.QueryAggregation
A modifier that will narrow down the document set of the sub aggregations it precedes.
- Attr str match
The filter written in Discovery Query Language syntax applied to the documents before sub aggregations are run.
- Attr int matching_results
Number of documents matching the filter.
- Attr List[QueryAggregation] aggregations
(optional) An array of sub aggregations.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryFilterAggregation[source]¶ Initialize a QueryFilterAggregation object from a json dictionary.
-
class
QueryGroupByAggregation
(type: str, *, results: List[QueryGroupByAggregationResult] = None)[source]¶ Bases:
ibm_watson.discovery_v2.QueryAggregation
Returns the top values for the field specified.
- Attr List[QueryGroupByAggregationResult] results
(optional) Array of top values for the field.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryGroupByAggregation[source]¶ Initialize a QueryGroupByAggregation object from a json dictionary.
-
class
QueryHistogramAggregation
(type: str, field: str, interval: int, *, name: str = None, results: List[QueryHistogramAggregationResult] = None)[source]¶ Bases:
ibm_watson.discovery_v2.QueryAggregation
Numeric interval segments to categorize documents by using field values from a single numeric field to describe the category.
- Attr str field
The numeric field name used to create the histogram.
- Attr int interval
The size of the sections the results are split into.
- Attr str name
(optional) Identifier specified in the query request of this aggregation.
- Attr List[QueryHistogramAggregationResult] results
(optional) Array of numeric intervals.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryHistogramAggregation[source]¶ Initialize a QueryHistogramAggregation object from a json dictionary.
-
class
QueryNestedAggregation
(type: str, path: str, matching_results: int, *, aggregations: List[QueryAggregation] = None)[source]¶ Bases:
ibm_watson.discovery_v2.QueryAggregation
A restriction that alter the document set used for sub aggregations it precedes to nested documents found in the field specified.
- Attr str path
The path to the document field to scope sub aggregations to.
- Attr int matching_results
Number of nested documents found in the specified field.
- Attr List[QueryAggregation] aggregations
(optional) An array of sub aggregations.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryNestedAggregation[source]¶ Initialize a QueryNestedAggregation object from a json dictionary.
-
class
QueryTermAggregation
(type: str, field: str, *, count: int = None, name: str = None, results: List[QueryTermAggregationResult] = None)[source]¶ Bases:
ibm_watson.discovery_v2.QueryAggregation
Returns the top values for the field specified.
- Attr str field
The field in the document used to generate top values from.
- Attr int count
(optional) The number of top values returned.
- Attr str name
(optional) Identifier specified in the query request of this aggregation.
- Attr List[QueryTermAggregationResult] results
(optional) Array of top values for the field.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryTermAggregation[source]¶ Initialize a QueryTermAggregation object from a json dictionary.
-
class
QueryTimesliceAggregation
(type: str, field: str, interval: str, *, name: str = None, results: List[QueryTimesliceAggregationResult] = None)[source]¶ Bases:
ibm_watson.discovery_v2.QueryAggregation
A specialized histogram aggregation that uses dates to create interval segments.
- Attr str field
The date field name used to create the timeslice.
- Attr str interval
The date interval value. Valid values are seconds, minutes, hours, days, weeks, and years.
- Attr str name
(optional) Identifier specified in the query request of this aggregation.
- Attr List[QueryTimesliceAggregationResult] results
(optional) Array of aggregation results.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryTimesliceAggregation[source]¶ Initialize a QueryTimesliceAggregation object from a json dictionary.
-
class
QueryTopHitsAggregation
(type: str, size: int, *, name: str = None, hits: Optional[ibm_watson.discovery_v2.QueryTopHitsAggregationResult] = None)[source]¶ Bases:
ibm_watson.discovery_v2.QueryAggregation
Returns the top documents ranked by the score of the query.
- Attr int size
The number of documents to return.
- Attr str name
(optional) Identifier specified in the query request of this aggregation.
- Attr QueryTopHitsAggregationResult hits
(optional)
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.discovery_v2.QueryTopHitsAggregation[source]¶ Initialize a QueryTopHitsAggregation object from a json dictionary.