**Algorithm:**

*x* = 0:0.1:1; *y* = trimf(*<sup>x</sup>*, [0.30 0.70 1.0]); plot(*<sup>x</sup>*,*y*) *x*label('trimf, *P* = [0.3 0.7 1.0]') *y*lim([ −0.05 1.05]

#### **4. Experiments and Results**

The results can be obtained by the use of algorithm of SentiWordNet and fuzzy logic. We collect reviews as an input. These are opinion sentences collection which is collected from the website www.Amazon.com and these are the reviews or comments expressed by the customers. We collect and store 1000 comments for two different Apple products. Once the reviews are taken out, then we applied pre-processing on it, parsed, tokenize and lemmatize these reviews. These sentences show

positive, negative and neutral type sentiments scores. So the results of sentiments scores are measured by using SentiWordNet 3.0 software. Here we show sentiment analysis process of a single review and we applied these above mentioned techniques in Java by using the platform "Eclipse". We choose this software because it takes less effort and made our task easier. We take simple review as an input and achieve our desired results.

We take the complete results of the sentiments analysis achieved by the reviews. We take a sentence level approach in which we take a single review and apply sentiment analysis on it. In order to calculate the percentage of total number of positive reviews, total number of neutral reviews and total number of negative reviews, we collect the total results obtained from sentiment analysis and take their percentage. From the above mentioned results shows that we have 320 reviews are positive, 105 are neutral reviews while 75 are negative reviews from the collection of 500 reviews. In order to calculate the percentage of positive, neutral and negative, we use a following formula.


Table 7 shows the accuracy of different types of reviews. We can more explain the number of Positive, neutral and negative reviews in the form of bar graph and their corresponding percentages in the form of pie graph of Apple iPhone 6s plus as shown in Figures 8 and 9.

**Table 7.** Overall percentage of Sentiment Analysis of Samsung Galaxy S8.


**Figure 8.** Bar chart for the number of reviews of Apple iPhone 6s plus.

**Figure 9.** Pie chart for the sentiment score Apple iPhone 6s plus (In percentage).

We also use fuzzy logic for the evaluating the loyalty with sentiment scores. We apply the rules which are simulated in MATLAB, these rules show the relation between sentiment score with types of loyalty, e.g., we see in the following figure that if we have sentiment score say 0.5 than our loyalty is also 0.5. Sentiment score are directly proportional to the type of customer loyalty, we can also say that if our sentiment score is 0.5, it is considered as neutral, the loyalty also lies at 0.468, very close to the value of sentiment score and this type of loyalty is considered as Latent loyalty (see Figure 10).

**Figure 10.** Rule Inference System in MATLAB.

We reached the conclusion that the online customers of Apple iPhone 6s plus mobile are very loyal as compared to other mobiles. It achieves the loyalty score of 64%. The features of Apple iPhone 6s plus are more reliable and their most of the online customers are satisfied with this product and services as well. It supports all the new versions and feature such as camera, memory and battery timings, etc. Table 8 shows a comparison of the results of our approach with the results of previous approaches.

The results shown in Table 8 represent that previous approaches mainly performed in precision that varies from 58.2 to 87.5% whereas recall for the previous approaches is quite low and ranges

from 52.0 to 79.44%. Similarly, the F-Score of previous approaches is also lower 53.0 to 77.98%. Our approach performs better as precision of our approach is 89.32%, recall is 80.36% and F-Score is 83.69%. The improvement in precision is minor however, the major improvement is in recall and F-measure.



The results of the presented approach for measuring customer loyalty to a product using sentiment analysis are shown in Figure 11 and the results are also compared with the previous approaches. The results show that our approach performs better than the previous approaches available in literature.

**Figure 11.** Rule Inference System in MATLAB.

A limitation of the presented implementation is that it processes only English language text that is grammatically correct and has no spelling mistakes in text.

#### **5. Conclusions and Future Work**

This paper addresses an important problem of measuring customer's loyalty to a specific product. Previously, general purpose sentiment analysis of tweets and posts are carried out however a task-oriented sentiment analysis of users' reviews of a product to find key features liked by the users and their confidence level is a new idea. In this paper, we presented a novel idea of using a fuzzy logic approach for measuring customer's loyalty to a product with the help of a sentiment analysis score. We use a Fuzzy logic approach which used membership functions and rule-based system of fuzzy sets which is used classifies the types of loyalty. It attained the average accuracy of 94% of positive which shows the number of customers which are loyal to the e-commerce products.

In this study we have experimented with the small sized reviews that are processing in separate sentences. In future, we aim to extend the ability of the implementation to process and handle large sized text. In the future, this work can be extended by considering both sentence types, i.e., subjective as well as objective. It aims to achieve more accuracy by these techniques. It also improves the speed when dealing with a large amount of data. Additionally, every organization or e-commerce site can use sentiment analysis because it is a very beneficial technique and, by using this, organizations take their business at the peak and will grow rapidly.

**Author Contributions:** U.G. is the main author of this paper and he has contributed in investigation of the problem, research design, experiments design and writing the original draft. I.S.B. has supervised this research work and contributed in design of the approach, writing, review and editing this paper. A.A. has contributed in implementation and coding of this research.

**Funding:** No funding is involved in this research.

**Conflicts of Interest:** The authors declare no conflict of interest.
