How to extract text insights in Fabric Copilot: step by step
This tutorial shows how to use Copilot in Fabric to extract entities (names, places, organizations) and sentiment from a set of comments and then generate an actionable summary. Knowing how to automate this task speeds up qualitative analyses and creates signals for reports in Power BI or ETL processes. We will work with a realistic example: a set of 500–5,000 customer comments to identify recurring issues and measure the percentage of negative feedback for prioritization.
Prerequisites
- An account with access to Microsoft Fabric and Copilot enabled. Check that your tenant has sufficient quotas for service calls (if using Azure OpenAI).
- List of comments in OneLake or a CSV file accessible in the Workspace. Ideally a file between 1 MB and 50 MB for testing; >100k rows may require sampling.
- Permissions to create Notebooks or Dataflows Gen2 in the Workspace and read/write permissions on the OneLake path you will use.
Step 1: Prepare the text data in the Workspace
Place a simple CSV file with an id column and a comment column in OneLake inside your Workspace, for example in /Shared/textos/comentarios.csv. This makes it easier for Copilot to access the content without additional authentication steps. For testing, use a small file (10–100 rows) and then scale to a larger file (500–5,000 rows). Minimal example of the file:
id,comment
1,"Adorei o produto, entrega rápida."
2,"Suporte fraco, demora na resposta."
3,"Ótima qualidade, recomendo à equipa."
Best practices: include metadata (date, channel, language) if available — this enables analyses by period or source. Also verify UTF-8 encoding to avoid issues with special characters.
Step 2: Open a Notebook and invoke Copilot
Create a Notebook in your Workspace (Python) and call Copilot. Ask it to read the CSV and show the first rows. This validates permission, path and format. For larger datasets, read in chunks (e.g.: chunksize=1000) and confirm available memory in the kernel.
# Pergunta ao Copilot: "Lê /Shared/textos/comentarios.csv e mostra as 5 primeiras linhas em DataFrame pandas"
# Código gerado pelo Copilot (exemplo mínimo):
import pandas as pd
df = pd.read_csv('/Workspace/Shared/textos/comentarios.csv')
df.head()
Tip: if the file has 10,000 rows and the notebook becomes slow, load only a sample for development: df = pd.read_csv(path, nrows=500).
Step 3: Ask Copilot to extract entities and sentiment
Explain to Copilot that you want two new columns: entities (list) and sentiment (positive/negative/neutral). Request an example approach using standard Python libraries available in the Notebook (for example, spaCy or Azure OpenAI if configured). If you don't have local models, ask for a prompt that uses a language service available in your tenant.
# Exemplo de função simples usando spaCy (se disponível no ambiente):
import spacy
nlp = spacy.load('en_core_web_sm') # ou o modelo necessário
def extract_entities(text):
doc = nlp(text)
return [(ent.text, ent.label_) for ent in doc.ents]
# Sentiment simples com TextBlob (se instalado) ou pedir ao Copilot para usar Azure OpenAI
from textblob import TextBlob
def sentiment_label(text):
polarity = TextBlob(text).sentiment.polarity
return 'positivo' if polarity>0.1 else 'negativo' if polarity<-0.1 else 'neutro'
# Aplicar
df['entities'] = df['comment'].apply(extract_entities)
df['sentiment'] = df['comment'].apply(sentiment_label)
Practical example: if out of 1,000 comments 230 are classified as 'negativo', that signal (23%) can be used to alert the support team. Adjust polarity thresholds (e.g. >0.15 for positive) according to language and domain.
Step 4: Handle common errors when using models in the Notebook
If Copilot suggests libraries not installed or large models fail, take one of these actions: install packages in the Notebook environment, ask Copilot for an alternative version that uses calls to a service (Azure OpenAI), or use simple heuristic logic (keyword-based) until you can get the model. Examples of common error messages: "Model not found" when loading spacy, "Permission denied" for OneLake, or "Rate limit exceeded" on Azure OpenAI calls.
# Instalar dependências (se o ambiente permitir):
!pip install spacy textblob
!python -m textblob.download_corpora
If you cannot install packages, ask Copilot to generate a simple rule-based function: look for words like "erro", "mau", "adoro" to infer sentiment as a fallback. Document any fallback for later review.
Step 5: Generate an actionable summary with Copilot
With the entities and sentiment columns, ask Copilot to produce a natural language summary with insights: main entities mentioned, percentage of negative comments, recurring topics and concrete recommendations (e.g. "investigate tickets for product X, prioritize onboarding improvement"). Copilot can generate a code block that computes aggregations and produces text in summary format for stakeholders.
# Exemplo de agregação e resumo
entities_flat = [ent[0] for sub in df['entities'] for ent in sub]
from collections import Counter
top_entities = Counter(entities_flat).most_common(5)
sent_counts = df['sentiment'].value_counts(normalize=True).to_dict()
summary = f"Top entidades: {top_entities}. Sentimentos: {sent_counts}. A recomendação inicial é investigar suporte para reduzir comentários negativos."
print(summary)
Include metrics: total number of comments analyzed, percentages by sentiment and a top 3 of entities with counts. For example: "Analyzed 1,250 comments — 18% negative, 62% neutral, 20% positive. Top entities: Product A (120 mentions), Delivery (98), Support (85)."
Verify the result
Confirm that the DataFrame has the entities and sentiment columns and that the textual summary makes sense. Check manual samples: 10 comments with entities and sentiment, and compare with expectations. If using Azure OpenAI, confirm that the calls were authorized, that tokens were not truncated and that the estimated cost for running in production is within budget (e.g. 0.5–2 USD per 1k requests, depending on plan).
Log simple metrics such as % negative to validate the signal and create a small validation matrix (e.g. 100 comments manually labeled to measure model/fallback precision/recall).
Conclusion
Using Copilot in Fabric to extract entities and sentiment transforms free text into structured signals ready for reporting and automations. Next steps: integrate this Notebook into a Dataflow Gen2 to automate ingestion, or create a report in Power BI connected to OneLake. Start with a data subset, validate manually and then scale — this reduces the risk of false positives and unnecessary costs. Small iterations (e.g.: validate 200 comments per sprint) help calibrate thresholds and improve models before production.