Introduction
Sentiment Analysis seeks to understand a subject’s attitude or emotional reaction towards a specific topic or brand. Sentiment Analysis does not have to be complicated and technical. It could be something as simple as getting a person in your team to find what is being said about your brand and product on the Review page and identify how much of it is good and how much of it isn’t. There is no need for a big budget and developing complicated software, the cognitive service text Analytics API is a cloud-based service that provides advanced natural language processing over raw text, and includes four main functions: sentiment analysis, key phrase extraction, language detection, and entity linking.
Most of the companies and brands now use sentiment analysis to find out what people are saying about them on social media. A bad review on social media can destroy a brand’s reputation if ignored or poorly handled. They aren’t simply rating their experience with 1 star or 5 stars. They’re also expressing their thoughts, feelings, expectations in free form text. This can be challenging to handle, especially if your company is getting a lot of feedback. When you have tens or even hundreds of thousands of pieces of feedback to read and manage, it's easy to use a cognitive text analytics service API.
The Sentiment Analysis API evaluates text input and returns a sentiment score for each document, ranging from 0 (negative) to 1 (positive). This capability is useful for detecting positive and negative sentiment in social media, customer reviews, and discussion forums. Content is provided by you, models and training data are provided by the service.
Currently, Sentiment Analysis supports English, German, Spanish, and French. Other languages are in the preview. In this article, I will show how we can integrate sentiment API from Xamarin Mobile application using visual studio 2019
Text Analytics API Price
The Text Analytics API can be purchased in units of the S0-S4 tier at a fixed price. Each unit of a tier comes with included quantities of API transactions. If the user exceeds the included quantities, overages are charged at the rate specified in the pricing table below. These overages are prorated and the service is billed on a monthly basis. The included quantities in a tier are reset each month. In the S tier, the service is billed for only the amount of Text Records submitted to the service. You can read more about pricing based on country check out here.
Create Text Analytics API Key
You need to create an Azure account, generate API key and endpoint URL based region for implementation to the Xamarin Mobile application.
Step 1
Step 2
Step 3
Step 4
Build Xamarin Forms Application using Visual Studio 2019
Let's start with creating a new Xamarin Forms Project using Visual Studio 2019. When accessing Visual Studio 2019 for the first time, you will come across a new interface for opening a creating the projects.
Open Run >> Type “Devenev.Exe” and enter >> Create New Project (Ctrl+Shift+N) or select open recent application.
The available templates will appear on a window like below. Select Xamarin Forms application with different mobile platforms.
Provide project name, location, and solution name and configure a new project screen,
Select as Blank apps and select the platform.
The Solution will be created with all the platform and PCL projects.
PCL UI Design
The UI will have a few elements on the screen and overlay the content view window. Editor control is for providing user input value and overlay window is for showing the result.
You can add Newtonsoft.JSON to solutions. Right-click on Solutions > Manage NuGet Packages > select Newtonsoft.Json from the Browse tab > click "Install".
- <?xml version="1.0" encoding="utf-8" ?>
- <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- xmlns:local="clr-namespace:MobileFeedback"
- x:Class="MobileFeedback.MainPage">
- <ContentPage.Content>
- <AbsoluteLayout>
- <!-- Normal Page Content -->
- <StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
- AbsoluteLayout.LayoutFlags="All">
- <Image Source="product.gif" VerticalOptions="Start" HorizontalOptions="Start" Margin="0,0,0,0" ></Image>
- <Editor x:Name="txtfeedback" WidthRequest="100" HeightRequest="200"></Editor>
- <Button Text="Submit" Clicked="Submit_Clicked"></Button>
- </StackLayout>
- <!-- Overlay -->
- <ContentView x:Name="overlay"
- AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
- AbsoluteLayout.LayoutFlags="All"
- IsVisible="False"
- BackgroundColor="#C0808080"
- Padding="10, 0">
- <StackLayout Orientation="Vertical"
- BackgroundColor="White"
- HeightRequest="175"
- WidthRequest="300"
- HorizontalOptions="Center"
- VerticalOptions="Start"
- Margin="0,20,0,0" >
- <Image x:Name="imgstatus" WidthRequest="70" HeightRequest="70"></Image>
- <Label Text="" x:Name="lblStatus"></Label>
- <StackLayout Orientation="Horizontal" HorizontalOptions="Center">
- <Button Text="OK" FontSize="Small"
- VerticalOptions="CenterAndExpand"
- HorizontalOptions="Center"
- Clicked="OnOKButtonClicked" />
- </StackLayout>
- </StackLayout>
- </ContentView>
- </AbsoluteLayout>
- </ContentPage.Content>
- </ContentPage>


Join the conversation! Your thoughts help the community grow.