trendscout 0.1.0__py3-none-any.whl

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.
trendscout/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """
2
+ TrendScout - AI-Powered Market Trend Analysis
3
+ """
4
+
5
+ __version__ = "0.1.0"
6
+
7
+ from .scraper import TrendScraper
8
+ from .sentiment import SentimentAnalyzer
trendscout/scraper.py ADDED
@@ -0,0 +1,52 @@
1
+ import requests
2
+ import pandas as pd
3
+ from typing import List, Dict
4
+ import random
5
+
6
+ class TrendScraper:
7
+ """
8
+ Scrapes trending topics from various sources.
9
+ """
10
+
11
+ def __init__(self, use_mock: bool = True):
12
+ self.use_mock = use_mock
13
+
14
+ def get_trends(self, topic: str = "technology") -> pd.DataFrame:
15
+ """
16
+ Get trending articles/posts about a topic.
17
+
18
+ Args:
19
+ topic: Keyword to search
20
+
21
+ Returns:
22
+ DataFrame with 'title', 'source', 'url', 'timestamp'
23
+ """
24
+ if self.use_mock:
25
+ return self._mock_trends(topic)
26
+
27
+ # TODO: Implement real scraping logic here
28
+ # For now, fallback to mock
29
+ return self._mock_trends(topic)
30
+
31
+ def _mock_trends(self, topic: str) -> pd.DataFrame:
32
+ """Generate dummy trend data."""
33
+ titles = [
34
+ f"Why {topic} is booming in 2026",
35
+ f"Top 10 {topic} trends to watch",
36
+ f"The future of {topic} explained",
37
+ f"Investors are flocking to {topic}",
38
+ f"{topic} crash imminent? Experts warn.",
39
+ ]
40
+
41
+ sources = ["TechCrunch", "Bloomberg", "Reuters", "The Verge", "Wired"]
42
+
43
+ data = []
44
+ for t in titles:
45
+ data.append({
46
+ "title": t,
47
+ "source": random.choice(sources),
48
+ "url": f"https://example.com/{random.randint(1000,9999)}",
49
+ "timestamp": pd.Timestamp.now()
50
+ })
51
+
52
+ return pd.DataFrame(data)
@@ -0,0 +1,31 @@
1
+ from textblob import TextBlob
2
+ import pandas as pd
3
+
4
+ class SentimentAnalyzer:
5
+ """
6
+ Analyzes sentiment of text data.
7
+ """
8
+
9
+ @staticmethod
10
+ def analyze(text: str) -> dict:
11
+ """Get sentiment score."""
12
+ blob = TextBlob(text)
13
+ return {
14
+ "polarity": blob.sentiment.polarity, # -1 to 1
15
+ "subjectivity": blob.sentiment.subjectivity # 0 to 1
16
+ }
17
+
18
+ def analyze_dataframe(self, df: pd.DataFrame, text_col: str) -> pd.DataFrame:
19
+ """Add sentiment columns to dataframe."""
20
+ df = df.copy()
21
+ df['sentiment'] = df[text_col].apply(lambda x: self.analyze(x)['polarity'])
22
+ df['subjectivity'] = df[text_col].apply(lambda x: self.analyze(x)['subjectivity'])
23
+
24
+ # Classify
25
+ def classify(score):
26
+ if score > 0.1: return "Positive"
27
+ if score < -0.1: return "Negative"
28
+ return "Neutral"
29
+
30
+ df['sentiment_label'] = df['sentiment'].apply(classify)
31
+ return df
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: trendscout
3
+ Version: 0.1.0
4
+ Summary: AI-Powered Market Trend Analysis & Sentinel
5
+ Requires-Python: >=3.8
6
+ Requires-Dist: requests
7
+ Requires-Dist: pandas
8
+ Requires-Dist: beautifulsoup4
9
+ Requires-Dist: textblob
10
+ Dynamic: requires-dist
11
+ Dynamic: requires-python
12
+ Dynamic: summary
@@ -0,0 +1,7 @@
1
+ trendscout/__init__.py,sha256=HmdMuNQaIiLKPB8j3-E8hvAhAJ_PJN0nlzMupg0lcB8,153
2
+ trendscout/scraper.py,sha256=6iT_O3T3muN2EWb2UFzpZzxwpksAumaQrypPMFb66wM,1572
3
+ trendscout/sentiment.py,sha256=4xJHOd2Fs07lkbP7i8f9I0eqgxZXpcP9jCG6DaLXskg,1026
4
+ trendscout-0.1.0.dist-info/METADATA,sha256=nx1VFwI3cj6ghMPpjNKWD98DRS-27DwpwBFBDd-5vsQ,295
5
+ trendscout-0.1.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
6
+ trendscout-0.1.0.dist-info/top_level.txt,sha256=Imz5ttBzuA5Pho9wyhBETIDaGjR8NZA9T8R-DDksqdc,11
7
+ trendscout-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ trendscout