sentor-ml 1.2.0__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - Initial release of sentor-ml Python SDK
12
+
13
+ ### Changed
14
+
15
+ ### Deprecated
16
+
17
+ ### Removed
18
+
19
+ ### Fixed
20
+
21
+ ### Security
22
+
23
+ ## [1.3.0] - 2024-01-XX
24
+
25
+ ### Added
26
+ - Initial release of sentor-ml Python SDK
27
+ - Support for sentiment analysis API
28
+ - Command-line interface
29
+
30
+ ### Changed
31
+
32
+ ### Fixed
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include CHANGELOG.md
3
+ include requirements.txt
@@ -1,209 +1,232 @@
1
- Metadata-Version: 2.4
2
- Name: sentor-ml
3
- Version: 1.2.0
4
- Summary: A Python SDK for interacting with the Sentor ML API for sentiment analysis
5
- Home-page: https://github.com/NIKX-Tech/sentor-ml-python-sdk
6
- Author: NIKX Technologies
7
- Author-email: sentor@nikx.one
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: Intended Audience :: Developers
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
- Requires-Python: >=3.7
19
- Description-Content-Type: text/markdown
20
- Requires-Dist: requests>=2.28.0
21
- Dynamic: author
22
- Dynamic: author-email
23
- Dynamic: classifier
24
- Dynamic: description
25
- Dynamic: description-content-type
26
- Dynamic: home-page
27
- Dynamic: requires-dist
28
- Dynamic: requires-python
29
- Dynamic: summary
30
-
31
- # Sentor Python SDK
32
-
33
- A Python SDK for interacting with the Sentor ML API for sentiment analysis. This SDK provides a simple and intuitive interface for sentiment analysis operations.
34
-
35
- ## Features
36
-
37
- - 🚀 Python 3.7+ support
38
- - ⚡ Simple and intuitive API
39
- - 🌍 Support for multiple languages
40
- - 📦 Batch processing capabilities
41
- - 🛡️ Comprehensive error handling
42
- - 🔄 Real-time sentiment analysis
43
-
44
- ## Installation
45
-
46
- ```bash
47
- pip install sentor-ml
48
- ```
49
-
50
- ### Work like a PRO
51
-
52
- 1. Go to [Sentor ML API](https://sentor.app/api)
53
- 2. Subscribe to the Starter plan
54
- 3. Get your API key
55
-
56
- ## Usage
57
-
58
- ### Basic Usage
59
-
60
- ```python
61
- from sentor import SentorClient
62
-
63
- # Initialize the client
64
- client = SentorClient('your-api-key')
65
-
66
- # Analyze sentiment
67
- input_data = [
68
- {
69
- "doc": "In the competitive landscape of consumer electronics, Apple and Samsung continue to lead the market with innovative products and strong brand loyalty. While Apple focuses on a tightly integrated ecosystem with devices like the iPhone, iPad, and Mac, Samsung excels in offering a wide range of options across various price points, especially in its Galaxy smartphone lineup. Both companies push the boundaries of technology, from cutting-edge chipsets to advanced camera systems, often setting industry trends that others follow.",
70
- "doc_id": "0",
71
- "entities": [
72
- "Apple",
73
- "Samsung",
74
- "camera"
75
- ]
76
- },
77
- {
78
- "doc": "Apple's new iPhone is amazing!",
79
- "doc_id": "1",
80
- "entities": [
81
- "Apple",
82
- "iPhone"
83
- ]
84
- },
85
- {
86
- "doc": "Samsung's new phone is amazing!",
87
- "doc_id": "2",
88
- "entities": [
89
- "Samsung",
90
- "phone"
91
- ]
92
- }
93
- ]
94
- result = client.analyze(input_data)
95
- print(result)
96
- ```
97
-
98
- ### Sample Output
99
-
100
- ```json
101
- {
102
- "results": [
103
- {
104
- "doc_id": "0",
105
- "predicted_class": 2,
106
- "predicted_label": "positive",
107
- "probabilities": {
108
- "negative": 0.00007679959526285529,
109
- "neutral": 0.0002924697764683515,
110
- "positive": 0.9996306896209717
111
- },
112
- "details": [
113
- {
114
- "sentence_index": 0,
115
- "sentence_text": "In the competitive landscape of consumer electronics, Apple and Samsung continue to lead the market with innovative products and strong brand loyalty.",
116
- "predicted_class": 2,
117
- "predicted_label": "positive",
118
- "probabilities": {
119
- "negative": 0.00009389198385179043,
120
- "neutral": 0.00032428017584607005,
121
- "positive": 0.9995818734169006
122
- }
123
- },
124
- {
125
- "sentence_index": 1,
126
- "sentence_text": "While Apple focuses on a tightly integrated ecosystem with devices like the iPhone, iPad, and Mac, Samsung excels in offering a wide range of options across various price points, especially in its Galaxy smartphone lineup.",
127
- "predicted_class": 2,
128
- "predicted_label": "positive",
129
- "probabilities": {
130
- "negative": 0.00005746580063714646,
131
- "neutral": 0.00012963586777914315,
132
- "positive": 0.99981290102005
133
- }
134
- },
135
- {
136
- "sentence_index": 2,
137
- "sentence_text": "Both companies push the boundaries of technology, from cutting-edge chipsets to advanced camera systems, often setting industry trends that others follow.",
138
- "predicted_class": 2,
139
- "predicted_label": "positive",
140
- "probabilities": {
141
- "negative": 0.00006366783054545522,
142
- "neutral": 0.00044553453335538507,
143
- "positive": 0.9994907379150391
144
- }
145
- }
146
- ]
147
- },
148
- {
149
- "doc_id": "1",
150
- "predicted_class": 2,
151
- "predicted_label": "positive",
152
- "probabilities": {
153
- "negative": 0.00010637375817168504,
154
- "neutral": 0.0002509312762413174,
155
- "positive": 0.9996427297592163
156
- },
157
- "details": [
158
- {
159
- "sentence_index": 0,
160
- "sentence_text": "Apple's new iPhone is amazing!",
161
- "predicted_class": 2,
162
- "predicted_label": "positive",
163
- "probabilities": {
164
- "negative": 0.00010637375817168504,
165
- "neutral": 0.0002509312762413174,
166
- "positive": 0.9996427297592163
167
- }
168
- }
169
- ]
170
- },
171
- {
172
- "doc_id": "2",
173
- "predicted_class": 2,
174
- "predicted_label": "positive",
175
- "probabilities": {
176
- "negative": 0.00010637375817168504,
177
- "neutral": 0.0002509312762413174,
178
- "positive": 0.9996427297592163
179
- },
180
- "details": [
181
- {
182
- "sentence_index": 0,
183
- "sentence_text": "Samsung's new phone is amazing!",
184
- "predicted_class": 2,
185
- "predicted_label": "positive",
186
- "probabilities": {
187
- "negative": 0.00010637375817168504,
188
- "neutral": 0.0002509312762413174,
189
- "positive": 0.9996427297592163
190
- }
191
- }
192
- ]
193
- }
194
- ]
195
- }
196
- ```
197
-
198
- ## API Reference
199
-
200
- Please refer to the [Sentor ML API Documentation](https://sentor.app/docs) for more details.
201
- You can also try the API in the [Sentor ML API Swagger Playground](https://sentor.app/docs).
202
-
203
- ## Contributing
204
-
205
- Contributions are welcome! Please feel free to submit a Pull Request.
206
-
207
- ## License
208
-
209
- MIT License - see the [LICENSE](LICENSE) file for details.
1
+ Metadata-Version: 2.4
2
+ Name: sentor-ml
3
+ Version: 1.3.0
4
+ Summary: A Python SDK for interacting with the Sentor ML API for sentiment analysis
5
+ Home-page: https://github.com/NIKX-Tech/sentor-ml-python-sdk
6
+ Author: NIKX Technologies
7
+ Author-email: sentor@nikx.one
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.7
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Requires-Python: >=3.7
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: requests>=2.28.0
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: requires-dist
28
+ Dynamic: requires-python
29
+ Dynamic: summary
30
+
31
+ # Sentor Python SDK
32
+
33
+ A Python SDK for interacting with the Sentor ML API for sentiment analysis. This SDK provides a simple and intuitive interface for sentiment analysis operations.
34
+
35
+ ## Features
36
+
37
+ - 🚀 Python 3.7+ support
38
+ - ⚡ Simple and intuitive API
39
+ - 🌍 Multi-language support (English and Dutch)
40
+ - 📦 Batch processing capabilities
41
+ - 🛡️ Comprehensive error handling
42
+ - 🔄 Real-time sentiment analysis
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install sentor-ml
48
+ ```
49
+
50
+ ### Work like a PRO
51
+
52
+ 1. Go to [Sentor ML API](https://sentor.app/api)
53
+ 2. Subscribe to the Starter plan
54
+ 3. Get your API key
55
+
56
+ ## Usage
57
+
58
+ ### Basic Usage
59
+
60
+ ```python
61
+ from sentor import SentorClient
62
+
63
+ # Initialize the client
64
+ client = SentorClient('your-api-key')
65
+
66
+ # Predict sentiment
67
+ input_data = [
68
+ {
69
+ "doc": "In the competitive landscape of consumer electronics, Apple and Samsung continue to lead the market with innovative products and strong brand loyalty. While Apple focuses on a tightly integrated ecosystem with devices like the iPhone, iPad, and Mac, Samsung excels in offering a wide range of options across various price points, especially in its Galaxy smartphone lineup. Both companies push the boundaries of technology, from cutting-edge chipsets to advanced camera systems, often setting industry trends that others follow.",
70
+ "doc_id": "0",
71
+ "entities": [
72
+ "Apple",
73
+ "Samsung",
74
+ "camera"
75
+ ]
76
+ },
77
+ {
78
+ "doc": "Apple's new iPhone is amazing!",
79
+ "doc_id": "1",
80
+ "entities": [
81
+ "Apple",
82
+ "iPhone"
83
+ ]
84
+ },
85
+ {
86
+ "doc": "Samsung's new phone is amazing!",
87
+ "doc_id": "2",
88
+ "entities": [
89
+ "Samsung",
90
+ "phone"
91
+ ]
92
+ }
93
+ ]
94
+ # Predict with default language (English)
95
+ result = client.predict(input_data)
96
+ print(result)
97
+
98
+ # Predict with Dutch language
99
+ result_nl = client.predict(input_data, language="nl")
100
+ print(result_nl)
101
+ ```
102
+
103
+ ### Language Support
104
+
105
+ The SDK supports multi-language sentiment analysis with the following options:
106
+
107
+ - `"en"` (default): English language prediction
108
+ - `"nl"`: Dutch language prediction
109
+
110
+ ```python
111
+ # Default English prediction
112
+ result_en = client.predict(documents)
113
+
114
+ # Explicitly specify English
115
+ result_en = client.predict(documents, language="en")
116
+
117
+ # Dutch language prediction
118
+ result_nl = client.predict(documents, language="nl")
119
+ ```
120
+
121
+ ### Sample Output
122
+
123
+ ```json
124
+ {
125
+ "results": [
126
+ {
127
+ "doc_id": "0",
128
+ "predicted_class": 2,
129
+ "predicted_label": "positive",
130
+ "probabilities": {
131
+ "negative": 0.00007679959526285529,
132
+ "neutral": 0.0002924697764683515,
133
+ "positive": 0.9996306896209717
134
+ },
135
+ "details": [
136
+ {
137
+ "sentence_index": 0,
138
+ "sentence_text": "In the competitive landscape of consumer electronics, Apple and Samsung continue to lead the market with innovative products and strong brand loyalty.",
139
+ "predicted_class": 2,
140
+ "predicted_label": "positive",
141
+ "probabilities": {
142
+ "negative": 0.00009389198385179043,
143
+ "neutral": 0.00032428017584607005,
144
+ "positive": 0.9995818734169006
145
+ }
146
+ },
147
+ {
148
+ "sentence_index": 1,
149
+ "sentence_text": "While Apple focuses on a tightly integrated ecosystem with devices like the iPhone, iPad, and Mac, Samsung excels in offering a wide range of options across various price points, especially in its Galaxy smartphone lineup.",
150
+ "predicted_class": 2,
151
+ "predicted_label": "positive",
152
+ "probabilities": {
153
+ "negative": 0.00005746580063714646,
154
+ "neutral": 0.00012963586777914315,
155
+ "positive": 0.99981290102005
156
+ }
157
+ },
158
+ {
159
+ "sentence_index": 2,
160
+ "sentence_text": "Both companies push the boundaries of technology, from cutting-edge chipsets to advanced camera systems, often setting industry trends that others follow.",
161
+ "predicted_class": 2,
162
+ "predicted_label": "positive",
163
+ "probabilities": {
164
+ "negative": 0.00006366783054545522,
165
+ "neutral": 0.00044553453335538507,
166
+ "positive": 0.9994907379150391
167
+ }
168
+ }
169
+ ]
170
+ },
171
+ {
172
+ "doc_id": "1",
173
+ "predicted_class": 2,
174
+ "predicted_label": "positive",
175
+ "probabilities": {
176
+ "negative": 0.00010637375817168504,
177
+ "neutral": 0.0002509312762413174,
178
+ "positive": 0.9996427297592163
179
+ },
180
+ "details": [
181
+ {
182
+ "sentence_index": 0,
183
+ "sentence_text": "Apple's new iPhone is amazing!",
184
+ "predicted_class": 2,
185
+ "predicted_label": "positive",
186
+ "probabilities": {
187
+ "negative": 0.00010637375817168504,
188
+ "neutral": 0.0002509312762413174,
189
+ "positive": 0.9996427297592163
190
+ }
191
+ }
192
+ ]
193
+ },
194
+ {
195
+ "doc_id": "2",
196
+ "predicted_class": 2,
197
+ "predicted_label": "positive",
198
+ "probabilities": {
199
+ "negative": 0.00010637375817168504,
200
+ "neutral": 0.0002509312762413174,
201
+ "positive": 0.9996427297592163
202
+ },
203
+ "details": [
204
+ {
205
+ "sentence_index": 0,
206
+ "sentence_text": "Samsung's new phone is amazing!",
207
+ "predicted_class": 2,
208
+ "predicted_label": "positive",
209
+ "probabilities": {
210
+ "negative": 0.00010637375817168504,
211
+ "neutral": 0.0002509312762413174,
212
+ "positive": 0.9996427297592163
213
+ }
214
+ }
215
+ ]
216
+ }
217
+ ]
218
+ }
219
+ ```
220
+
221
+ ## API Reference
222
+
223
+ Please refer to the [Sentor ML API Documentation](https://sentor.app/docs) for more details.
224
+ You can also try the API in the [Sentor ML API Swagger Playground](https://sentor.app/docs).
225
+
226
+ ## Contributing
227
+
228
+ Contributions are welcome! Please feel free to submit a Pull Request.
229
+
230
+ ## License
231
+
232
+ MIT License - see the [LICENSE](LICENSE) file for details.