contentintelpy 0.1.5__tar.gz → 0.1.6__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.
Files changed (28) hide show
  1. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/PKG-INFO +1 -1
  2. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/__init__.py +11 -2
  3. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/nodes/sentiment_node.py +22 -16
  4. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/utils/model_registry.py +1 -0
  5. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy.egg-info/PKG-INFO +1 -1
  6. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/pyproject.toml +1 -1
  7. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/LICENSE +0 -0
  8. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/README.md +0 -0
  9. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/nodes/classification_node.py +0 -0
  10. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/nodes/keyword_extract_node.py +0 -0
  11. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/nodes/language_node.py +0 -0
  12. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/nodes/location_node.py +0 -0
  13. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/nodes/ner_node.py +0 -0
  14. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/nodes/summarization_node.py +0 -0
  15. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/nodes/translation_node.py +0 -0
  16. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/pipeline/base_node.py +0 -0
  17. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/pipeline/context.py +0 -0
  18. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/pipeline/pipeline.py +0 -0
  19. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/services/ner_service.py +0 -0
  20. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/services/sentiment_service.py +0 -0
  21. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/services/summarization_service.py +0 -0
  22. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/services/translation_service.py +0 -0
  23. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy/utils/lazy_import.py +0 -0
  24. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy.egg-info/SOURCES.txt +0 -0
  25. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy.egg-info/dependency_links.txt +0 -0
  26. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy.egg-info/requires.txt +0 -0
  27. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/contentintelpy.egg-info/top_level.txt +0 -0
  28. {contentintelpy-0.1.5 → contentintelpy-0.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: contentintelpy
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: Production-grade NLP library for unified content intelligence.
5
5
  Author-email: Ronit Fulari <ronitfulari31@gmail.com>
6
6
  License: MIT
@@ -1,8 +1,17 @@
1
+ import warnings
2
+ import os
3
+ import sys
4
+
5
+ # Suppress HuggingFace/Transformers deprecation warnings globally
6
+ warnings.filterwarnings("ignore", category=FutureWarning)
7
+ warnings.filterwarnings("ignore", message=".*TRANSFORMERS_CACHE.*")
8
+ os.environ["TRANSFORMERS_NO_ADVISORY_WARNINGS"] = "1"
9
+ os.environ["HF_HUB_DISABLE_SYMLINKS_WARNING"] = "1"
10
+
11
+ import importlib
1
12
  from .pipeline.pipeline import Pipeline
2
13
  from .pipeline.context import PipelineContext
3
14
  from .pipeline.base_node import Node
4
- import importlib
5
- import sys
6
15
 
7
16
  def _show_welcome_hint():
8
17
  """Shows a concise setup hint if core optional dependencies are missing."""
@@ -47,25 +47,31 @@ class SentimentNode(Node):
47
47
  try:
48
48
  analyzer = registry.get_sentiment_pipeline()
49
49
  # Truncate to model max length (~512 tokens)
50
- result = analyzer(text_to_analyze[:512])
51
- # Result: [{'label': 'positive', 'score': 0.98}]
50
+ outputs = analyzer(text_to_analyze[:512])
52
51
 
53
- if result and len(result) > 0:
54
- top = result[0]
55
- label_en = top['label'].lower() # positive, negative, neutral
56
- score = top['score']
52
+ if not outputs or not isinstance(outputs, list):
53
+ raise ValueError("Unexpected sentiment output format")
57
54
 
58
- # Resolve Native Label
59
- label_native = label_en
60
- if original_lang in self.LABEL_MAP:
61
- label_native = self.LABEL_MAP[original_lang].get(label_en, label_en)
55
+ # Handle nested list if pipeline returned list-of-lists (standard for some HF models)
56
+ if len(outputs) > 0 and isinstance(outputs[0], list):
57
+ outputs = outputs[0]
62
58
 
63
- context["sentiment"] = {
64
- "value": label_native,
65
- "value_en": label_en,
66
- "confidence": round(score, 4)
67
- }
68
- logger.debug(f"Sentiment: {label_en} ({score:.2f})")
59
+ # The correct sentiment is the entry with the highest score
60
+ top = max(outputs, key=lambda x: x["score"])
61
+ label_en = top['label'].lower() # positive, negative, neutral
62
+ score = top['score']
63
+
64
+ # Resolve Native Label
65
+ label_native = label_en
66
+ if original_lang in self.LABEL_MAP:
67
+ label_native = self.LABEL_MAP[original_lang].get(label_en, label_en)
68
+
69
+ context["sentiment"] = {
70
+ "value": label_native,
71
+ "value_en": label_en,
72
+ "confidence": round(float(score), 4)
73
+ }
74
+ logger.debug(f"Sentiment: {label_en} ({score:.2f})")
69
75
 
70
76
  except Exception as e:
71
77
  logger.error(f"Sentiment analysis failed: {e}")
@@ -6,6 +6,7 @@ import warnings
6
6
 
7
7
  # Suppress HuggingFace warnings for cleaner logs
8
8
  warnings.filterwarnings("ignore", category=UserWarning)
9
+ warnings.filterwarnings("ignore", category=FutureWarning)
9
10
 
10
11
  logger = logging.getLogger("contentintelpy.registry")
11
12
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: contentintelpy
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: Production-grade NLP library for unified content intelligence.
5
5
  Author-email: Ronit Fulari <ronitfulari31@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "contentintelpy"
7
- version = "0.1.5"
7
+ version = "0.1.6"
8
8
  description = "Production-grade NLP library for unified content intelligence."
9
9
  authors = [
10
10
  { name = "Ronit Fulari", email = "ronitfulari31@gmail.com" },
File without changes
File without changes
File without changes