AIAS1/5_bigdata_sdks/kafka_sentiment_analysis_sdk
2024-11-13 10:21:20 +08:00
..
models update readme. 2024-11-07 16:40:05 +08:00
src/main no message 2023-07-08 22:09:44 +08:00
kafka_sentiment_analysis_sdk.iml no message 2023-07-08 22:09:44 +08:00
pom.xml no message 2023-07-08 22:09:44 +08:00
README_cn.md 更新模型加载说明 2024-11-13 10:21:20 +08:00
README.md no message 2023-07-08 22:09:44 +08:00

Download the model and place it in the models directory

Kafka Sentiment Analysis [English] SDK

Sentiment Analysis (Sentiment Classification) For text with subjective descriptions, it can automatically determine the sentiment polarity category of the text and give the corresponding confidence level, which can help enterprises understand user consumption habits, analyze hot topics and crisis public opinion monitoring, and provide favorable decision support for enterprises.

img

SDK algorithm:

  • The sentiment polarity is divided into two categories -Negative -Positive

1. Start zookeeper:

zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties

2. Start kafka:

kafka-server-start /usr/local/etc/kafka/server.properties

3. Create a topic:

kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic twitter-data

4. Download and import test data (twitter data.txt file under src/test/resources directory)

Click to download test data

kafka-console-producer --broker-list localhost:9092 --topic twitter-data < data.txt

5. Run the example- SentimentAnalysisExample

After successful operation, the command line should see the following information:

...
content: is alone downstairs...working 
prediction: [
	class: "Negative", probability: 0.98781
	class: "Positive", probability: 0.01218
]
content: I feel bad for doing it 
prediction: [
	class: "Negative", probability: 0.99725
	class: "Positive", probability: 0.00274
]
content: @RyanSeacrest is it just me, or she hates anoop. i mean seriously, she's kinda mean to him. 
prediction: [
	class: "Negative", probability: 0.99816
	class: "Positive", probability: 0.00183
]
...

Install Kafka in Mac environment

brew install kafka