From bf04ab8507f8ba601863caded139bc2f4eee1b0c Mon Sep 17 00:00:00 2001 From: stud203799 Date: Tue, 14 Apr 2026 17:02:09 +0300 Subject: [PATCH] start work --- .idea/.gitignore | 3 + .idea/E_Commerce_Review_Engine.iml | 8 ++ .idea/inspectionProfiles/Project_Default.xml | 7 ++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 7 ++ .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 ++ data.csv | 3 + main.py | 80 +++++++++++++++++++ 9 files changed, 128 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/E_Commerce_Review_Engine.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 data.csv create mode 100644 main.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/E_Commerce_Review_Engine.iml b/.idea/E_Commerce_Review_Engine.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/E_Commerce_Review_Engine.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..46b0337 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..db8786c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4347ec4 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/data.csv b/data.csv new file mode 100644 index 0000000..1c910ec --- /dev/null +++ b/data.csv @@ -0,0 +1,3 @@ +1;5;good job +2;5;nice price +3;5;super work \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..3b77824 --- /dev/null +++ b/main.py @@ -0,0 +1,80 @@ +# Система анализа и модерации отзывов на товары (E-Commerce Review Engine) + +def clean_text(text: str): + + return str + + +def extract_keywords(text: str, keywords_dict: dict): + + return list + + +def calculate_sentiment_score(text: str, positive_words: set, negative_words: set): + + return float + + +def validate_rating(rating: int): + + return bool + + +def is_spam(text: str, spam_indicators: list): + + return bool + + +def enrich_review(review: dict, keywords_dict: dict, positive_words: set, negative_words: set): + + return dict + + +def filter_valid_reviews(reviews: list): + + return list + + +def calculate_average_rating_by_topic(reviews: list): + + return dict + + +def detect_anomalies(reviews: list, sentiment_threshold: float = 0.5): + + return list + + +def generate_summary_report(valid_reviews: list, all_reviews_count: int, anomalies: list): + + return dict + + +def main(): + print("\n======== Введите название файла с форматом .csv или используйте по умолчанию (Enter) ========") + name_report = input() + if not name_report: + name_report = "data.csv" + #проверка на правильность ввода имени файла + if name_report[-4:] == ".csv": + try: + report = open(name_report, 'r+', encoding='cp1251') + except: + print("Файл отсутствует") + else: + #запись файла в список + print("Содержимое файла:") + dec_report = list() + for i in report: + dec_report.append(i) + report.close() + print("id rating text") + for i in dec_report: + print(i) + else: + print("Неверный тип файла! " + "\nНеобходимо выбрать файл с форматом .csv") + + +if __name__ == "__main__": + main() \ No newline at end of file