This project demonstrates how to use Azure AI's Text Analytics API to perform natural language processing tasks such as language detection, sentiment analysis, key phrase extraction, and entity recognition on text documents.
This is part of a hands-on exercise to prepare for the Microsoft AI-900: Azure AI Fundamentals certification.
.
├── reviews/ # Folder containing text files to be analyzed
├── .env # Environment file with Azure AI credentials
├── analyze_reviews.py # Main script for analyzing text documents
├── README.md # Project documentation
This script uses Azure's TextAnalyticsClient
to perform the following tasks on each text file in the reviews/
folder:
- Detect Language
- Analyze Sentiment
- Extract Key Phrases
- Recognize Named Entities
- Recognize Linked Entities
- Python 3.7+
- Azure subscription with Azure Cognitive Services enabled
- Provisioned Text Analytics resource in Azure
- Clone the repository or copy the script.
- Install dependencies:
pip install azure-ai-textanalytics python-dotenv
- Create a
.env
file in the project root:
azureAI_Endpoint=https://<your-resource-name>.cognitiveservices.azure.com/
azureKey=<your-text-analytics-key>
- Add
.txt
files to thereviews/
folder for analysis.
Run the script:
python analyze_reviews.py
Each file's results will be printed to the console, including detected language, sentiment, key phrases, named entities, and linked entities.