/// <summary> /// Finds named entities (currently proper names and common nouns) in the text /// along with entity types, salience, mentions for each entity, and /// other properties. /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// The RPC response. /// </returns> public override AnalyzeEntitiesResponse AnalyzeEntities( AnalyzeEntitiesRequest request, CallSettings callSettings = null) { Modify_AnalyzeEntitiesRequest(ref request, ref callSettings); return(_callAnalyzeEntities.Sync(request, callSettings)); }
public void AnalyzeEntities_RequestObject() { // Snippet: AnalyzeEntities(AnalyzeEntitiesRequest,CallSettings) // Create client LanguageServiceClient languageServiceClient = LanguageServiceClient.Create(); // Initialize request argument(s) AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document(), }; // Make the request AnalyzeEntitiesResponse response = languageServiceClient.AnalyzeEntities(request); // End snippet }
/// <summary> /// Finds named entities (currently finds proper names) in the text, /// entity types, salience, mentions for each entity, and other properties. /// </summary> /// <param name="document"> /// Input document. /// </param> /// <param name="encodingType"> /// The encoding type used by the API to calculate offsets. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// The RPC response. /// </returns> public override AnalyzeEntitiesResponse AnalyzeEntities( Document document, EncodingType encodingType, CallSettings callSettings = null) { AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = document, EncodingType = encodingType, }; Modify_AnalyzeEntitiesRequest(ref request, ref callSettings); return(_callAnalyzeEntities.Sync(request, callSettings)); }
// [START language_entities_gcs_core] /// <summary> /// Analyze entities in text stored in GCS /// </summary> public static void SampleAnalyzeEntities(string gcsUr) { LanguageServiceClient languageServiceClient = LanguageServiceClient.Create(); // string gcsUr = "gs://cloud-samples-data/language/entity.txt" AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document { Type = Document.Types.Type.PlainText, GcsContentUri = "gs://cloud-samples-data/language/entity.txt", }, }; AnalyzeEntitiesResponse response = languageServiceClient.AnalyzeEntities(request); // FIXME: inspect the results }
// [START language_entities_text_core] /// <summary> /// Analyze entities in text /// </summary> public static void SampleAnalyzeEntities(string textContent) { LanguageServiceClient languageServiceClient = LanguageServiceClient.Create(); // string textContent = "California is a state." AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document { Type = Document.Types.Type.PlainText, Content = "California is a state.", }, }; AnalyzeEntitiesResponse response = languageServiceClient.AnalyzeEntities(request); // FIXME: inspect the results }
public async Task AnalyzeEntitiesAsync_RequestObject() { // Snippet: AnalyzeEntitiesAsync(AnalyzeEntitiesRequest,CallSettings) // Create client LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync(); // Initialize request argument(s) AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document(), }; // Make the request AnalyzeEntitiesResponse response = await languageServiceClient.AnalyzeEntitiesAsync(request); // End snippet }
/// <summary>Snippet for AnalyzeEntitiesAsync</summary> public async Task AnalyzeEntitiesRequestObjectAsync() { // Snippet: AnalyzeEntitiesAsync(AnalyzeEntitiesRequest, CallSettings) // Additional: AnalyzeEntitiesAsync(AnalyzeEntitiesRequest, CancellationToken) // Create client LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync(); // Initialize request argument(s) AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document(), EncodingType = EncodingType.None, }; // Make the request AnalyzeEntitiesResponse response = await languageServiceClient.AnalyzeEntitiesAsync(request); // End snippet }
public async Task AnalyzeEntitiesAsync2() { Mock <LanguageService.LanguageServiceClient> mockGrpcClient = new Mock <LanguageService.LanguageServiceClient>(MockBehavior.Strict); AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document(), }; AnalyzeEntitiesResponse expectedResponse = new AnalyzeEntitiesResponse { Language = "language-1613589672", }; mockGrpcClient.Setup(x => x.AnalyzeEntitiesAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <AnalyzeEntitiesResponse>(Task.FromResult(expectedResponse), null, null, null, null)); LanguageServiceClient client = new LanguageServiceClientImpl(mockGrpcClient.Object, null); AnalyzeEntitiesResponse response = await client.AnalyzeEntitiesAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void AnalyzeEntities2() { Mock <LanguageService.LanguageServiceClient> mockGrpcClient = new Mock <LanguageService.LanguageServiceClient>(MockBehavior.Strict); AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document(), }; AnalyzeEntitiesResponse expectedResponse = new AnalyzeEntitiesResponse { Language = "language-1613589672", }; mockGrpcClient.Setup(x => x.AnalyzeEntities(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); LanguageServiceClient client = new LanguageServiceClientImpl(mockGrpcClient.Object, null); AnalyzeEntitiesResponse response = client.AnalyzeEntities(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void AnalyzeEntities1() { moq::Mock <LanguageService.LanguageServiceClient> mockGrpcClient = new moq::Mock <LanguageService.LanguageServiceClient>(moq::MockBehavior.Strict); AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document(), EncodingType = EncodingType.None, }; AnalyzeEntitiesResponse expectedResponse = new AnalyzeEntitiesResponse { Entities = { new Entity(), }, Language = "language7dae1285", }; mockGrpcClient.Setup(x => x.AnalyzeEntities(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); LanguageServiceClient client = new LanguageServiceClientImpl(mockGrpcClient.Object, null); AnalyzeEntitiesResponse response = client.AnalyzeEntities(request.Document, request.EncodingType); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task AnalyzeEntities1Async() { moq::Mock <LanguageService.LanguageServiceClient> mockGrpcClient = new moq::Mock <LanguageService.LanguageServiceClient>(moq::MockBehavior.Strict); AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest { Document = new Document(), EncodingType = EncodingType.None, }; AnalyzeEntitiesResponse expectedResponse = new AnalyzeEntitiesResponse { Entities = { new Entity(), }, Language = "language7dae1285", }; mockGrpcClient.Setup(x => x.AnalyzeEntitiesAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AnalyzeEntitiesResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); LanguageServiceClient client = new LanguageServiceClientImpl(mockGrpcClient.Object, null); AnalyzeEntitiesResponse responseCallSettings = await client.AnalyzeEntitiesAsync(request.Document, request.EncodingType, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AnalyzeEntitiesResponse responseCancellationToken = await client.AnalyzeEntitiesAsync(request.Document, request.EncodingType, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
partial void Modify_AnalyzeEntitiesRequest(ref AnalyzeEntitiesRequest request, ref CallSettings settings);
/// <summary> /// Finds named entities (currently proper names and common nouns) in the text /// along with entity types, salience, mentions for each entity, and /// other properties. /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// The RPC response. /// </returns> public virtual AnalyzeEntitiesResponse AnalyzeEntities( AnalyzeEntitiesRequest request, CallSettings callSettings = null) { throw new NotImplementedException(); }
/// Documentation https://developers.google.com/cloudnaturallanguage/v1/reference/documents/analyzeEntities /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated CloudNaturalLanguage service.</param> /// <param name="body">A valid CloudNaturalLanguage v1 body.</param> /// <returns>AnalyzeEntitiesResponseResponse</returns> public static AnalyzeEntitiesResponse AnalyzeEntities(CloudNaturalLanguageService service, AnalyzeEntitiesRequest body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Make the request. return(service.Documents.AnalyzeEntities(body).Execute()); } catch (Exception ex) { throw new Exception("Request Documents.AnalyzeEntities failed.", ex); } }