Update main.py
هذا الالتزام موجود في:
22
main.py
22
main.py
@@ -8,7 +8,6 @@
|
||||
|
||||
from flask import Flask, request, jsonify
|
||||
from flask_cors import CORS
|
||||
import spacy
|
||||
import re
|
||||
from collections import defaultdict
|
||||
import json
|
||||
@@ -22,28 +21,7 @@ CORS(app)
|
||||
cached_results = {}
|
||||
|
||||
|
||||
def process_ranked_keywords(response_data):
|
||||
"""
|
||||
Process the API response, filter for location keywords using spaCy, and sort by volume
|
||||
"""
|
||||
all_keywords = []
|
||||
|
||||
for post_id, post_data in response_data.items():
|
||||
if "ranked" in post_data:
|
||||
for keyword_data in post_data["ranked"]:
|
||||
all_keywords.append(keyword_data)
|
||||
|
||||
# Filter and sort keywords using spaCy location detection only
|
||||
location_keywords, non_location_keywords = filter_and_sort_keywords_by_location(all_keywords)
|
||||
|
||||
# Save results to file
|
||||
with open('results.json', 'w') as f:
|
||||
json.dump({
|
||||
'location_keywords': location_keywords,
|
||||
'non_location_keywords': non_location_keywords
|
||||
}, f, indent=2)
|
||||
|
||||
return location_keywords
|
||||
|
||||
@app.route('/get_ranked_kw_for_domain', methods=['GET', 'POST'])
|
||||
def get_ranked_keywords():
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم