Watson Developer Cloud .NET Standard SDK
6.1.0
The .NET SDK uses the Watson Developer Cloud services, a collection of REST APIs and SDKs that use cognitive computing to solve complex problems.
|
Classes | |
class | UpdateDocumentEnums |
Enum values for UpdateDocument. More... | |
Public Member Functions | |
DiscoveryService (string version, WebProxy webProxy=null) | |
DiscoveryService (string version, IAuthenticator authenticator, WebProxy webProxy=null) | |
DiscoveryService (string version, string serviceName, WebProxy webProxy=null) | |
DiscoveryService (IClient httpClient) | |
DiscoveryService (string version, string serviceName, IAuthenticator authenticator, WebProxy webProxy=null) | |
DetailedResponse< ListProjectsResponse > | ListProjects () |
List projects. More... | |
DetailedResponse< ProjectDetails > | CreateProject (string name, string type, DefaultQueryParams defaultQueryParameters=null) |
Create a project. More... | |
DetailedResponse< ProjectDetails > | GetProject (string projectId) |
Get project. More... | |
DetailedResponse< ProjectDetails > | UpdateProject (string projectId, string name=null) |
Update a project. More... | |
DetailedResponse< object > | DeleteProject (string projectId) |
Delete a project. More... | |
DetailedResponse< ListFieldsResponse > | ListFields (string projectId, List< string > collectionIds=null) |
List fields. More... | |
DetailedResponse< ListCollectionsResponse > | ListCollections (string projectId) |
List collections. More... | |
DetailedResponse< CollectionDetails > | CreateCollection (string projectId, string name, string description=null, string language=null, List< CollectionEnrichment > enrichments=null) |
Create a collection. More... | |
DetailedResponse< CollectionDetails > | GetCollection (string projectId, string collectionId) |
Get collection. More... | |
DetailedResponse< CollectionDetails > | UpdateCollection (string projectId, string collectionId, string name=null, string description=null, List< CollectionEnrichment > enrichments=null) |
Update a collection. More... | |
DetailedResponse< object > | DeleteCollection (string projectId, string collectionId) |
Delete a collection. More... | |
DetailedResponse< ListDocumentsResponse > | ListDocuments (string projectId, string collectionId, long? count=null, string status=null, bool? hasNotices=null, bool? isParent=null, string parentDocumentId=null, string sha256=null) |
List documents. More... | |
DetailedResponse< DocumentAccepted > | UpdateDocument (string projectId, string collectionId, string documentId, System.IO.MemoryStream file=null, string filename=null, string fileContentType=null, string metadata=null, bool? xWatsonDiscoveryForce=null) |
Add a document. More... | |
DetailedResponse< DeleteDocumentResponse > | DeleteDocument (string projectId, string collectionId, string documentId, bool? xWatsonDiscoveryForce=null) |
Delete a document. More... | |
DetailedResponse< QueryResponse > | Query (string projectId, List< string > collectionIds=null, string filter=null, string query=null, string naturalLanguageQuery=null, string aggregation=null, long? count=null, List< string > _return=null, long? offset=null, string sort=null, bool? highlight=null, bool? spellingSuggestions=null, QueryLargeTableResults tableResults=null, QueryLargeSuggestedRefinements suggestedRefinements=null, QueryLargePassages passages=null, QueryLargeSimilar similar=null) |
Query a project. More... | |
DetailedResponse< Completions > | GetAutocompletion (string projectId, string prefix, List< string > collectionIds=null, string field=null, long? count=null) |
Get Autocomplete Suggestions. More... | |
DetailedResponse< QueryNoticesResponse > | QueryCollectionNotices (string projectId, string collectionId, string filter=null, string query=null, string naturalLanguageQuery=null, long? count=null, long? offset=null) |
Query collection notices. More... | |
DetailedResponse< QueryNoticesResponse > | QueryNotices (string projectId, string filter=null, string query=null, string naturalLanguageQuery=null, long? count=null, long? offset=null) |
Query project notices. More... | |
DetailedResponse< StopWordList > | GetStopwordList (string projectId, string collectionId) |
Get a custom stop words list. More... | |
DetailedResponse< StopWordList > | CreateStopwordList (string projectId, string collectionId, List< string > stopwords=null) |
Create a custom stop words list. More... | |
DetailedResponse< object > | DeleteStopwordList (string projectId, string collectionId) |
Delete a custom stop words list. More... | |
DetailedResponse< Expansions > | ListExpansions (string projectId, string collectionId) |
Get the expansion list. More... | |
DetailedResponse< Expansions > | CreateExpansions (string projectId, string collectionId, List< Expansion > expansions) |
Create or update an expansion list. More... | |
DetailedResponse< object > | DeleteExpansions (string projectId, string collectionId) |
Delete the expansion list. More... | |
DetailedResponse< ComponentSettingsResponse > | GetComponentSettings (string projectId) |
List component settings. More... | |
DetailedResponse< TrainingQuerySet > | ListTrainingQueries (string projectId) |
List training queries. More... | |
DetailedResponse< object > | DeleteTrainingQueries (string projectId) |
Delete training queries. More... | |
DetailedResponse< TrainingQuery > | CreateTrainingQuery (string projectId, string naturalLanguageQuery, List< TrainingExample > examples, string filter=null) |
Create training query. More... | |
DetailedResponse< TrainingQuery > | GetTrainingQuery (string projectId, string queryId) |
Get a training data query. More... | |
DetailedResponse< TrainingQuery > | UpdateTrainingQuery (string projectId, string queryId, string naturalLanguageQuery, List< TrainingExample > examples, string filter=null) |
Update a training query. More... | |
DetailedResponse< object > | DeleteTrainingQuery (string projectId, string queryId) |
Delete a training data query. More... | |
DetailedResponse< Enrichments > | ListEnrichments (string projectId) |
List enrichments. More... | |
DetailedResponse< Enrichment > | CreateEnrichment (string projectId, CreateEnrichment enrichment, System.IO.MemoryStream file=null) |
Create an enrichment. More... | |
DetailedResponse< Enrichment > | GetEnrichment (string projectId, string enrichmentId) |
Get enrichment. More... | |
DetailedResponse< Enrichment > | UpdateEnrichment (string projectId, string enrichmentId, string name, string description=null) |
Update an enrichment. More... | |
DetailedResponse< object > | DeleteEnrichment (string projectId, string enrichmentId) |
Delete an enrichment. More... | |
DetailedResponse< DocumentClassifiers > | ListDocumentClassifiers (string projectId) |
List document classifiers. More... | |
DetailedResponse< DocumentClassifier > | CreateDocumentClassifier (string projectId, System.IO.MemoryStream trainingData, CreateDocumentClassifier classifier, System.IO.MemoryStream testData=null) |
Create a document classifier. More... | |
DetailedResponse< DocumentClassifier > | GetDocumentClassifier (string projectId, string classifierId) |
Get a document classifier. More... | |
DetailedResponse< DocumentClassifier > | UpdateDocumentClassifier (string projectId, string classifierId, UpdateDocumentClassifier classifier, System.IO.MemoryStream trainingData=null, System.IO.MemoryStream testData=null) |
Update a document classifier. More... | |
DetailedResponse< object > | DeleteDocumentClassifier (string projectId, string classifierId) |
Delete a document classifier. More... | |
DetailedResponse< DocumentClassifierModels > | ListDocumentClassifierModels (string projectId, string classifierId) |
List document classifier models. More... | |
DetailedResponse< DocumentClassifierModel > | CreateDocumentClassifierModel (string projectId, string classifierId, string name, string description=null, double? learningRate=null, List< double?> l1RegularizationStrengths=null, List< double?> l2RegularizationStrengths=null, long? trainingMaxSteps=null, double? improvementRatio=null) |
Create a document classifier model. More... | |
DetailedResponse< DocumentClassifierModel > | GetDocumentClassifierModel (string projectId, string classifierId, string modelId) |
Get a document classifier model. More... | |
DetailedResponse< DocumentClassifierModel > | UpdateDocumentClassifierModel (string projectId, string classifierId, string modelId, string name=null, string description=null) |
Update a document classifier model. More... | |
DetailedResponse< object > | DeleteDocumentClassifierModel (string projectId, string classifierId, string modelId) |
Delete a document classifier model. More... | |
![]() | |
DetailedResponse< DocumentAccepted > | AddDocument (string projectId, string collectionId, System.IO.MemoryStream file=null, string filename=null, string fileContentType=null, string metadata=null, bool? xWatsonDiscoveryForce=null) |
DetailedResponse< DocumentDetails > | GetDocument (string projectId, string collectionId, string documentId) |
DetailedResponse< AnalyzedDocument > | AnalyzeDocument (string projectId, string collectionId, System.IO.MemoryStream file=null, string filename=null, string fileContentType=null, string metadata=null) |
DetailedResponse< object > | DeleteUserData (string customerId) |
Properties | |
string | Version [get, set] |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Create a collection.
Create a new collection in the specified project.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
name | The name of the collection. |
description | A description of the collection. (optional) |
language | The language of the collection. For a list of supported languages, see the product documentation. (optional, default to en) |
enrichments | An array of enrichments that are applied to this collection. To get a list of enrichments that are available for a project, use the List enrichments method. |
If no enrichments are specified when the collection is created, the default enrichments for the project type are applied. For more information about project default settings, see the product documentation. (optional)
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Create a document classifier.
Create a document classifier. You can use the API to create a document classifier in any project type. After you create a document classifier, you can use the Enrichments API to create a classifier enrichment, and then the Collections API to apply the enrichment to a collection in the project.
Note: This method is supported on installed instances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
trainingData | The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single field, use a semicolon as the value separator. For a sample file, see the product documentation. |
classifier | An object that manages the settings and data that is required to train a document classification model. |
testData | The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Create a document classifier model.
Create a document classifier model by training a model that uses the data and classifier settings defined in the specified document classifier.
Note: This method is supported on installed intances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
classifierId | The ID of the classifier. |
name | The name of the document classifier model. |
description | A description of the document classifier model. (optional) |
learningRate | A tuning parameter in an optimization algorithm that determines the step size at each iteration of the training process. It influences how much of any newly acquired information overrides the existing information, and therefore is said to represent the speed at which a machine learning model learns. The default value is 0.1 . (optional) |
l1RegularizationStrengths | Avoids overfitting by shrinking the coefficient of less important features to zero, which removes some features altogether. You can specify many values for hyper-parameter optimization. The default value is [0.000001] . (optional, default to [1.0E-6]) |
l2RegularizationStrengths | A method you can apply to avoid overfitting your model on the training data. You can specify many values for hyper-parameter optimization. The default value is [0.000001] . (optional, default to [1.0E-6]) |
trainingMaxSteps | Maximum number of training steps to complete. This setting is useful if you need the training process to finish in a specific time frame to fit into an automated process. The default value is ten million. (optional) |
improvementRatio | Stops the training run early if the improvement ratio is not met by the time the process reaches a certain point. The default value is 0.00001 . (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Create an enrichment.
Create an enrichment for use with the specified project. To apply the enrichment to a collection in the project, use the Collections API.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
enrichment | Information about a specific enrichment. |
file | The enrichment file to upload. Expected file types per enrichment are as follows: |
dictionary
uima_annotator
and rule_based
(Explorer)watson_knowledge_studio_model
and rule_based
(Studio Advanced Rule Editor). (optional)Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Create or update an expansion list.
Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
expansions | An array of query expansion definitions. |
Each object in the expansions array represents a term or set of terms that will be expanded into other terms. Each expansion object can be configured as bidirectional
or unidirectional
.
expanded_terms
list expands to include all expanded terms. For example, a query for ibm
expands to ibm OR international business machines OR big blue
.input_terms
in the query are replaced by the terms in expanded_terms
. For example, a query for the often misused term on premise
is converted to on premises OR on-premises
and does not contain the original term. If you want an input term to be included in the query, then repeat the input term in the expanded terms list.Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Create a project.
Create a new project for this instance.
name | The human readable name of this project. |
type | The type of project. |
The content_intelligence
type is a Document Retrieval for Contracts project and the other
type is a Custom project.
The content_mining
and content_intelligence
types are available with Premium plan managed deployments and installed deployments only.
defaultQueryParameters | Default query parameters for this project. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Create a custom stop words list.
Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot contain more than 1 million characters.
A default stop words list is used by all collections. The default list is applied both at indexing time and at query time. A custom stop words list that you add is used at query time only.
The custom stop words list augments the default stop words list; you cannot remove stop words. For information about the default stop words lists per language, see the product documentation.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
stopwords | List of stop words. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Create training query.
Add a query to the training data for this project. The query can contain a filter and natural language query.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
naturalLanguageQuery | The natural text query that is used as the training query. |
examples | Array of training examples. |
filter | The filter used on the collection before the natural_language_query is applied. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete a collection.
Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete a document.
Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the collection permanently. If you delete a document that was added by crawling an external data source, the document will be added again with the next scheduled crawl of the data source. The delete function removes the document from the collection, not from the external data source.
Note: Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete a subdocument, and then repeat the action that created it, the deleted document is added back in to your collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead. You can get the document ID of the original document from the parent_document_id
of the subdocument result.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
documentId | The ID of the document. |
xWatsonDiscoveryForce | When true , the uploaded document is added to the collection even if the data for that collection is shared with other collections. (optional, default to false) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete a document classifier.
Deletes an existing document classifier from the specified project.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
classifierId | The ID of the classifier. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete a document classifier model.
Deletes an existing document classifier model from the specified project.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
classifierId | The ID of the classifier. |
modelId | The ID of the classifier model. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete an enrichment.
Deletes an existing enrichment from the specified project.
Note: Only enrichments that have been manually created can be deleted.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
enrichmentId | The ID of the enrichment. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete the expansion list.
Removes the expansion information for this collection. To disable query expansion for a collection, delete the expansion list.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete a project.
Deletes the specified project.
Important: Deleting a project deletes everything that is part of the specified project, including all collections.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete a custom stop words list.
Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list is deleted, the default stop words list is used.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete training queries.
Removes all training queries for the specified project.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Delete a training data query.
Removes details from a training data query, including the query string and all examples.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
queryId | The ID of the query used for training. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get Autocomplete Suggestions.
Returns completion query suggestions for the specified prefix.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
prefix | The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to hot , housing , or how . |
collectionIds | Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used. (optional) |
field | The field in the result documents that autocompletion suggestions are identified from. (optional) |
count | The number of autocompletion suggestions to return. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get collection.
Get details about the specified collection.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List component settings.
Returns default configuration settings for components.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get a document classifier.
Get details about a specific document classifier.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
classifierId | The ID of the classifier. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get a document classifier model.
Get details about a specific document classifier model.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
classifierId | The ID of the classifier. |
modelId | The ID of the classifier model. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get enrichment.
Get details about a specific enrichment.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
enrichmentId | The ID of the enrichment. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get project.
Get details on the specified project.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get a custom stop words list.
Returns the custom stop words list that is used by the collection. For information about the default stop words lists that are applied to queries, see the product documentation.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get a training data query.
Get details for a specific training data query, including the query string and all examples.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
queryId | The ID of the query used for training. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List collections.
Lists existing collections for the specified project.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List document classifier models.
Get a list of the document classifier models in a project. Returns only the name and model ID of each document classifier model.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
classifierId | The ID of the classifier. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List document classifiers.
Get a list of the document classifiers in a project. Returns only the name and classifier ID of each document classifier.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List documents.
Lists the documents in the specified collection. The list includes only the document ID of each document and returns information for up to 10,000 documents.
Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
count | The maximum number of documents to return. Up to 1,000 documents are returned by default. The maximum number allowed is 10,000. (optional) |
status | Filters the documents to include only documents with the specified ingestion status. The options include: |
available
: Ingestion is finished and the document is indexed.failed
: Ingestion is finished, but the document is not indexed because of an error.pending
: The document is uploaded, but the ingestion process is not started.processing
: Ingestion is in progress.You can specify one status value or add a comma-separated list of more than one status value. For example, available,failed
. (optional)
hasNotices | If set to true , only documents that have notices, meaning documents for which warnings or errors were generated during the ingestion, are returned. If set to false , only documents that don't have notices are returned. If unspecified, no filter based on notices is applied. |
Notice details are not available in the result, but you can use the Query collection notices method to find details by adding the parameter query=notices.document_id:{document-id}
. (optional)
isParent | If set to true , only parent documents, meaning documents that were split during the ingestion process and resulted in two or more child documents, are returned. If set to false , only child documents are returned. If unspecified, no filter based on the parent or child relationship is applied. |
CSV files, for example, are split into separate documents per line and JSON files are split into separate documents per object. (optional)
parentDocumentId | Filters the documents to include only child documents that were generated when the specified parent document was processed. (optional) |
sha256 | Filters the documents to include only documents with the specified SHA-256 hash. Format the hash as a hexadecimal string. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List enrichments.
Lists the enrichments available to this project. The Part of Speech and Sentiment of Phrases enrichments might be listed, but are reserved for internal use only.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Get the expansion list.
Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty expansions array is returned.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List fields.
Gets a list of the unique fields (and their types) stored in the specified collections.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionIds | Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List projects.
Lists existing projects for this instance.
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
List training queries.
List the training queries for the specified project.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Query a project.
Search your data by submitting queries that are written in natural language or formatted in the Discovery Query Language. For more information, see the Discovery documentation. The default query parameters differ by project type. For more information about the project default settings, see the Discovery documentation. See the Projects API documentation for details about how to set custom default query settings.
The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000 characters in English.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionIds | A comma-separated list of collection IDs to be queried against. (optional) |
filter | Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values. (optional) |
query | A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. Use a query search when you want to find the most relevant search results. (optional) |
naturalLanguageQuery | A natural language query that returns relevant documents by using training data and natural language understanding. (optional) |
aggregation | 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 more information about the supported types of aggregations, see the Discovery documentation. (optional) |
count | Number of results to return. (optional) |
_return | A list of the fields in the document hierarchy to return. You can specify both root-level (text ) and nested (extracted_metadata.filename ) fields. If this parameter is an empty list, then all fields are returned. (optional) |
offset | 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. (optional) |
sort | 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. (optional) |
highlight | When true , a highlight field is returned for each result that contains fields that match the query. The matching query terms are emphasized with surrounding <em></em> tags. This parameter is ignored if passages.enabled and passages.per_document are true , in which case passages are returned for each document instead of highlights. (optional) |
spellingSuggestions | 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). (optional) |
tableResults | Configuration for table retrieval. (optional) |
suggestedRefinements | Configuration for suggested refinements. |
Note: The suggested_refinements parameter that identified dynamic facets from the data is deprecated. (optional)
passages | Configuration for passage retrieval. (optional) |
similar | Finds results from documents that are similar to documents of interest. Use this parameter to add a More like these function to your search. You can include this parameter with or without a query, filter or natural_language_query parameter. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Query collection notices.
Finds collection-level notices (errors and warnings) that are generated when documents are ingested.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
filter | Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation , query , or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values. (optional) |
query | A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. (optional) |
naturalLanguageQuery | A natural language query that returns relevant documents by using training data and natural language understanding. (optional) |
count | Number of results to return. The maximum for the count and offset values together in any one query is 10,000. (optional) |
offset | 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. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Query project notices.
Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
filter | Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation , query , or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values. (optional) |
query | A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. (optional) |
naturalLanguageQuery | A natural language query that returns relevant documents by using training data and natural language understanding. (optional) |
count | Number of results to return. The maximum for the count and offset values together in any one query is 10,000. (optional) |
offset | 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. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Update a collection.
Updates the specified collection's name, description, and enrichments.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
name | The new name of the collection. (optional) |
description | The new description of the collection. (optional) |
enrichments | An array of enrichments that are applied to this collection. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Add a document.
Add a document to a collection with optional metadata.
Returns immediately after the system has accepted the document for processing.
Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.
application/octet-stream
), then the service attempts to automatically detect the document's media type.true
./v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}
). If a document already exists with the specified ID, it is replaced.For more information about how certain file types and field names are handled when a file is added to a collection, see the product documentation.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
file | When adding a document, the content of the document to ingest. For maximum supported file size limits, see the documentation. |
When analyzing a document, the content of the document to analyze but not ingest. Only the application/json
content type is supported currently. For maximum supported file size limits, see the product documentation. (optional)
filename | The filename for file. (optional) |
fileContentType | The content type of file. (optional) |
metadata | Add information about the file that you want to include in the response. |
The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.
Example:
``` { "filename": "favorites2.json", "file_type": "json" }. (optional)
xWatsonDiscoveryForce | When true , the uploaded document is added to the collection even if the data for that collection is shared with other collections. (optional, default to false) |
*/ public DetailedResponse<DocumentAccepted> AddDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null) { if (string.IsNullOrEmpty(Version)) { throw new ArgumentNullException("`Version` is required"); } if (string.IsNullOrEmpty(projectId)) { throw new ArgumentNullException("`projectId` is required for `AddDocument`"); } else { projectId = Uri.EscapeDataString(projectId); } if (string.IsNullOrEmpty(collectionId)) { throw new ArgumentNullException("`collectionId` is required for `AddDocument`"); } else { collectionId = Uri.EscapeDataString(collectionId); } DetailedResponse<DocumentAccepted> result = null;
try { var formData = new MultipartFormDataContent();
if (file != null) { var fileContent = new ByteArrayContent(file.ToArray()); System.Net.Http.Headers.MediaTypeHeaderValue contentType; System.Net.Http.Headers.MediaTypeHeaderValue.TryParse(fileContentType, out contentType); fileContent.Headers.ContentType = contentType; formData.Add(fileContent, "file", filename); }
if (metadata != null) { var metadataContent = new StringContent(metadata, Encoding.UTF8, HttpMediaType.TEXT_PLAIN); metadataContent.Headers.ContentType = null; formData.Add(metadataContent, "metadata"); }
IClient client = this.Client; SetAuthentication();
var restRequest = client.PostAsync($"{this.Endpoint}/v2/projects/{projectId}/collections/{collectionId}/documents");
restRequest.WithHeader("Accept", "application/json");
if (xWatsonDiscoveryForce != null) { restRequest.WithHeader("X-Watson-Discovery-Force", (bool)xWatsonDiscoveryForce ? "true" : "false"); } if (!string.IsNullOrEmpty(Version)) { restRequest.WithArgument("version", Version); } restRequest.WithBodyContent(formData);
restRequest.WithHeaders(Common.GetSdkHeaders("discovery", "v2", "AddDocument")); restRequest.WithHeaders(customRequestHeaders); ClearCustomRequestHeaders();
result = restRequest.As<DocumentAccepted>().Result; if (result == null) { result = new DetailedResponse<DocumentAccepted>(); } } catch (AggregateException ae) { throw ae.Flatten(); }
return result; }
/**
Enum values for AddDocument.
*/ public class AddDocumentEnums { /**
The content type of file.
*/ public class FileContentTypeValue { /**
Constant APPLICATION_JSON for application/json
*/ public const string APPLICATION_JSON = "application/json"; /**
Constant APPLICATION_MSWORD for application/msword
*/ public const string APPLICATION_MSWORD = "application/msword"; /**
Constant APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT for application/vnd.openxmlformats-officedocument.wordprocessingml.document
*/ public const string APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; /**
Constant APPLICATION_PDF for application/pdf
*/ public const string APPLICATION_PDF = "application/pdf"; /**
Constant TEXT_HTML for text/html
*/ public const string TEXT_HTML = "text/html"; /**
Constant APPLICATION_XHTML_XML for application/xhtml+xml
*/ public const string APPLICATION_XHTML_XML = "application/xhtml+xml";
} }
/**
Get document details.
Get details about a specific document, whether the document is added by uploading a file or by crawling an external data source.
Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
documentId | The ID of the document. |
*/ public DetailedResponse<DocumentDetails> GetDocument(string projectId, string collectionId, string documentId) { if (string.IsNullOrEmpty(Version)) { throw new ArgumentNullException("`Version` is required"); } if (string.IsNullOrEmpty(projectId)) { throw new ArgumentNullException("`projectId` is required for `GetDocument`"); } else { projectId = Uri.EscapeDataString(projectId); } if (string.IsNullOrEmpty(collectionId)) { throw new ArgumentNullException("`collectionId` is required for `GetDocument`"); } else { collectionId = Uri.EscapeDataString(collectionId); } if (string.IsNullOrEmpty(documentId)) { throw new ArgumentNullException("`documentId` is required for `GetDocument`"); } else { documentId = Uri.EscapeDataString(documentId); } DetailedResponse<DocumentDetails> result = null;
try { IClient client = this.Client; SetAuthentication();
var restRequest = client.GetAsync($"{this.Endpoint}/v2/projects/{projectId}/collections/{collectionId}/documents/{documentId}");
restRequest.WithHeader("Accept", "application/json"); if (!string.IsNullOrEmpty(Version)) { restRequest.WithArgument("version", Version); }
restRequest.WithHeaders(Common.GetSdkHeaders("discovery", "v2", "GetDocument")); restRequest.WithHeaders(customRequestHeaders); ClearCustomRequestHeaders();
result = restRequest.As<DocumentDetails>().Result; if (result == null) { result = new DetailedResponse<DocumentDetails>(); } } catch (AggregateException ae) { throw ae.Flatten(); }
return result; }
/**
Update a document.
Replace an existing document or add a document with a specified document ID. Starts ingesting a document with optional metadata.
Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.
If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true
.
Notes:
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
collectionId | The ID of the collection. |
documentId | The ID of the document. |
file | When adding a document, the content of the document to ingest. For maximum supported file size limits, see the documentation. |
When analyzing a document, the content of the document to analyze but not ingest. Only the application/json
content type is supported currently. For maximum supported file size limits, see the product documentation. (optional)
filename | The filename for file. (optional) |
fileContentType | The content type of file. (optional) |
metadata | Add information about the file that you want to include in the response. |
The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.
Example:
``` { "filename": "favorites2.json", "file_type": "json" }. (optional)
xWatsonDiscoveryForce | When true , the uploaded document is added to the collection even if the data for that collection is shared with other collections. (optional, default to false) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Update a document classifier.
Update the document classifier name or description, update the training data, or add or update the test data.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
classifierId | The ID of the classifier. |
classifier | An object that contains a new name or description for a document classifier, updated training data, or new or updated test data. |
trainingData | The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single column, use a semicolon as the value separator. For a sample file, see the product documentation. (optional) |
testData | The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Update a document classifier model.
Update the document classifier model name or description.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
classifierId | The ID of the classifier. |
modelId | The ID of the classifier model. |
name | A new name for the enrichment. (optional) |
description | A new description for the enrichment. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Update an enrichment.
Updates an existing enrichment's name and description.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
enrichmentId | The ID of the enrichment. |
name | A new name for the enrichment. |
description | A new description for the enrichment. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Update a project.
Update the specified project's name.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
name | The new name to give this project. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
inline |
Update a training query.
Updates an existing training query and it's examples.
projectId | The ID of the project. This information can be found from the Integrate and Deploy page in Discovery. |
queryId | The ID of the query used for training. |
naturalLanguageQuery | The natural text query that is used as the training query. |
examples | Array of training examples. |
filter | The filter used on the collection before the natural_language_query is applied. (optional) |
Implements IBM.Watson.Discovery.v2.IDiscoveryService.
|
getset |