Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -347,7 +347,7 @@ def fetch_latest_arxiv_papers(keywords: list, num_results: int = 5) -> list:
|
|
| 347 |
# ✅ Construct the query for ArXiv API
|
| 348 |
query = "+AND+".join([f"all:{kw}" for kw in keywords])
|
| 349 |
query_encoded = urllib.parse.quote(query)
|
| 350 |
-
url = f"http://export.arxiv.org/api/query?search_query={query_encoded}&start=0&max_results=
|
| 351 |
|
| 352 |
# ✅ Fetch papers from ArXiv
|
| 353 |
feed = feedparser.parse(url)
|
|
@@ -370,7 +370,7 @@ def fetch_latest_arxiv_papers(keywords: list, num_results: int = 5) -> list:
|
|
| 370 |
|
| 371 |
# ✅ TF-IDF Vectorization
|
| 372 |
corpus = [paper["title"] + " " + paper["abstract"] for paper in papers]
|
| 373 |
-
vectorizer = TfidfVectorizer(stop_words=stopwords.words('english'))
|
| 374 |
tfidf_matrix = vectorizer.fit_transform(corpus)
|
| 375 |
|
| 376 |
# ✅ Transform Query into TF-IDF Vector
|
|
|
|
| 347 |
# ✅ Construct the query for ArXiv API
|
| 348 |
query = "+AND+".join([f"all:{kw}" for kw in keywords])
|
| 349 |
query_encoded = urllib.parse.quote(query)
|
| 350 |
+
url = f"http://export.arxiv.org/api/query?search_query={query_encoded}&start=0&max_results=5&sortBy=submittedDate&sortOrder=descending"
|
| 351 |
|
| 352 |
# ✅ Fetch papers from ArXiv
|
| 353 |
feed = feedparser.parse(url)
|
|
|
|
| 370 |
|
| 371 |
# ✅ TF-IDF Vectorization
|
| 372 |
corpus = [paper["title"] + " " + paper["abstract"] for paper in papers]
|
| 373 |
+
vectorizer = TfidfVectorizer(stop_words=stopwords.words('english'),max_features=3000)
|
| 374 |
tfidf_matrix = vectorizer.fit_transform(corpus)
|
| 375 |
|
| 376 |
# ✅ Transform Query into TF-IDF Vector
|