Classificar texto em categorias com a API Natural Language avaliações

73295 avaliações

Deepnita M. · Revisado há over 2 years

Bad formatted bigquery python script with some errors not working Script must be like: ``` # Import necessary libraries from google.cloud import storage, language, bigquery # Set up your GCS, NL, and BigQuery clients storage_client = storage.Client() nl_client = language.LanguageServiceClient() bq_client = bigquery.Client(project='qwiklabs-gcp-01-b8b997bbdb2b') # Define dataset and table dataset_ref = bq_client.dataset('news_classification_dataset') dataset = bigquery.Dataset(dataset_ref) table_ref = dataset.table('article_data') table = bq_client.get_table(table_ref) # Function to classify the text def classify_text(article): response = nl_client.classify_text( document=language.Document( content=article, type_=language.Document.Type.PLAIN_TEXT ) ) return response rows_for_bq = [] files = storage_client.bucket('qwiklabs-test-bucket-gsp063').list_blobs() print("Got article files from GCS, sending them to the NL API (this will take ~2 minutes)...") # Send files to the NL API and save the result to send to BigQuery for file in files: if file.name.endswith('txt'): article_text = file.download_as_bytes() nl_response = classify_text(article_text) if len(nl_response.categories) > 0: rows_for_bq.append((str(article_text), nl_response.categories[0].name, nl_response.categories[0].confidence)) print("Writing NL API article data to BigQuery...") # Write article text + category data to BQ errors = bq_client.insert_rows(table, rows_for_bq) assert errors == [] ```

OLEG M. · Revisado há over 2 years

семен И. · Revisado há over 2 years

Nickolay K. · Revisado há over 2 years

Denys V. · Revisado há over 2 years

Volodymyr P. · Revisado há over 2 years

Дмитро М. · Revisado há over 2 years

Vinicius G. · Revisado há over 2 years

Данило Ч. · Revisado há over 2 years

Satrajit S. · Revisado há over 2 years

In task 6. The Python code is copied with a syntax error. Namely, the declaration of variables is not on a new line

Oleksandr K. · Revisado há over 2 years

Ihor K. · Revisado há over 2 years

Yuriy K. · Revisado há over 2 years

muito bom

Paulo K999 G. · Revisado há over 2 years

D P. · Revisado há over 2 years

Pooja R. · Revisado há over 2 years

Sheeraz C. · Revisado há over 2 years

I was not able to finish it. When I run Pyton script I'he got an error "SyntaxError: invalid syntax" at line 5

Елена Л. · Revisado há over 2 years

Mykhailo T. · Revisado há over 2 years

Serhii K. · Revisado há over 2 years

Mykola V. · Revisado há over 2 years

Volodymyr M. · Revisado há over 2 years

Pratik N. · Revisado há over 2 years

Pavel D. · Revisado há over 2 years

Python script is outdated with wrong syntax

Evgenia S. · Revisado há over 2 years

Não garantimos que as avaliações publicadas sejam de consumidores que compraram ou usaram os produtos. As avaliações não são verificadas pelo Google.