steam-review-analysis 0.1.0__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 (62) hide show
  1. steam_review_analysis-0.1.0/.gitignore +23 -0
  2. steam_review_analysis-0.1.0/CHANGELOG.md +42 -0
  3. steam_review_analysis-0.1.0/LICENSE +22 -0
  4. steam_review_analysis-0.1.0/PKG-INFO +200 -0
  5. steam_review_analysis-0.1.0/README.md +145 -0
  6. steam_review_analysis-0.1.0/configs/games.toml +27 -0
  7. steam_review_analysis-0.1.0/configs/presets.toml +62 -0
  8. steam_review_analysis-0.1.0/docs/analysis.md +159 -0
  9. steam_review_analysis-0.1.0/docs/data_pipeline.md +94 -0
  10. steam_review_analysis-0.1.0/docs/data_schema.md +46 -0
  11. steam_review_analysis-0.1.0/pyproject.toml +161 -0
  12. steam_review_analysis-0.1.0/src/steam_review_analysis/__init__.py +45 -0
  13. steam_review_analysis-0.1.0/src/steam_review_analysis/__main__.py +7 -0
  14. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/__init__.py +1 -0
  15. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/arguments.py +146 -0
  16. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/artifacts.py +91 -0
  17. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/cli.py +368 -0
  18. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/dataset.py +261 -0
  19. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/nltk_resources.py +86 -0
  20. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/plotting.py +450 -0
  21. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/presets.py +111 -0
  22. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/report.py +324 -0
  23. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/sentiment.py +145 -0
  24. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/sentiment_comparison.py +171 -0
  25. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/statistics.py +108 -0
  26. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/text.py +253 -0
  27. steam_review_analysis-0.1.0/src/steam_review_analysis/analysis/transformer_sentiment.py +722 -0
  28. steam_review_analysis-0.1.0/src/steam_review_analysis/cli.py +335 -0
  29. steam_review_analysis-0.1.0/src/steam_review_analysis/config.py +104 -0
  30. steam_review_analysis-0.1.0/src/steam_review_analysis/io.py +160 -0
  31. steam_review_analysis-0.1.0/src/steam_review_analysis/processing/__init__.py +1 -0
  32. steam_review_analysis-0.1.0/src/steam_review_analysis/processing/cleaning.py +196 -0
  33. steam_review_analysis-0.1.0/src/steam_review_analysis/py.typed +0 -0
  34. steam_review_analysis-0.1.0/src/steam_review_analysis/schema.py +53 -0
  35. steam_review_analysis-0.1.0/src/steam_review_analysis/scraping/__init__.py +10 -0
  36. steam_review_analysis-0.1.0/src/steam_review_analysis/scraping/driver.py +38 -0
  37. steam_review_analysis-0.1.0/src/steam_review_analysis/scraping/parsers.py +87 -0
  38. steam_review_analysis-0.1.0/src/steam_review_analysis/scraping/scraper.py +206 -0
  39. steam_review_analysis-0.1.0/src/steam_review_analysis/scraping/service.py +61 -0
  40. steam_review_analysis-0.1.0/src/steam_review_analysis/scraping/settings.py +67 -0
  41. steam_review_analysis-0.1.0/tests/analysis/conftest.py +100 -0
  42. steam_review_analysis-0.1.0/tests/analysis/test_analysis_cli.py +204 -0
  43. steam_review_analysis-0.1.0/tests/analysis/test_artifacts.py +37 -0
  44. steam_review_analysis-0.1.0/tests/analysis/test_dataset.py +128 -0
  45. steam_review_analysis-0.1.0/tests/analysis/test_nltk_resources.py +58 -0
  46. steam_review_analysis-0.1.0/tests/analysis/test_plotting.py +203 -0
  47. steam_review_analysis-0.1.0/tests/analysis/test_presets.py +49 -0
  48. steam_review_analysis-0.1.0/tests/analysis/test_report.py +113 -0
  49. steam_review_analysis-0.1.0/tests/analysis/test_sentiment.py +99 -0
  50. steam_review_analysis-0.1.0/tests/analysis/test_sentiment_comparison.py +96 -0
  51. steam_review_analysis-0.1.0/tests/analysis/test_statistics.py +80 -0
  52. steam_review_analysis-0.1.0/tests/analysis/test_text.py +132 -0
  53. steam_review_analysis-0.1.0/tests/analysis/test_transformer_sentiment.py +421 -0
  54. steam_review_analysis-0.1.0/tests/test_atomic_writes.py +74 -0
  55. steam_review_analysis-0.1.0/tests/test_cleaning.py +224 -0
  56. steam_review_analysis-0.1.0/tests/test_cli.py +264 -0
  57. steam_review_analysis-0.1.0/tests/test_io_and_config.py +66 -0
  58. steam_review_analysis-0.1.0/tests/test_parsers.py +72 -0
  59. steam_review_analysis-0.1.0/tests/test_raw_writes.py +129 -0
  60. steam_review_analysis-0.1.0/tests/test_scraper.py +125 -0
  61. steam_review_analysis-0.1.0/tests/test_scraping_service.py +162 -0
  62. steam_review_analysis-0.1.0/tests/test_scroll_loop.py +221 -0
@@ -0,0 +1,23 @@
1
+ # Data: scraped user content, reproducible via `steam-review-analysis scrape`
2
+ data/raw/*
3
+ data/processed/*
4
+ !data/**/.gitkeep
5
+
6
+ # Python
7
+ __pycache__/
8
+ *.py[cod]
9
+ *.egg-info/
10
+ dist/
11
+ .venv/
12
+ .env
13
+
14
+ # Tool outputs: caches, coverage data and generated API docs (`make docs-build`)
15
+ artifacts/
16
+
17
+ # Jupyter
18
+ .ipynb_checkpoints/
19
+
20
+ # OS / IDE
21
+ .DS_Store
22
+ .idea/
23
+ .vscode/
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ All notable changes are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - not yet released
10
+
11
+ First packaged release.
12
+
13
+ ### Added
14
+
15
+ - `steam-review-analysis` command with `scrape`, `clean`, `analyse` and `download-nltk`
16
+ subcommands, `--version`, and global `--data-dir` / `--log-level` options accepted before or
17
+ after the command name.
18
+ - Selenium scraper for Steam Community reviews with validated settings and safe,
19
+ create-only CSV publication.
20
+ - Cleaning of raw reviews into a typed, deduplicated dataset.
21
+ - Analysis: NLTK preprocessing, word frequencies and word clouds, VADER sentiment,
22
+ before/after statistics, plots and a full `report` workflow.
23
+ - Optional Jev-style transformer sentiment models and a comparison of sentiment methods
24
+ against Steam recommendations.
25
+ - Analysis presets loaded from TOML files (`--preset`, `--presets`).
26
+ - Optional extras: `scrape`, `analysis`, `sentiment` and `all`; the core needs only pandas.
27
+ - Type information (`py.typed`) and a top-level API (`import steam_review_analysis`).
28
+
29
+ ### Changed
30
+
31
+ - Data is read from and written to `--data-dir`, `$STEAM_REVIEW_ANALYSIS_DATA_DIR` or
32
+ `./data`, never relative to the installed package.
33
+ - Processed data and analysis outputs are written atomically.
34
+ - Library code no longer downloads NLTK corpora implicitly; the CLI does, and
35
+ `download-nltk` installs them explicitly.
36
+
37
+ ### Fixed
38
+
39
+ - Zipped NLTK corpora (`wordnet`, `vader_lexicon`) were reported as missing, which triggered a
40
+ download check on every call.
41
+ - Minimum versions: `matplotlib>=3.9` and `wordcloud>=1.9.3` (older versions fail with the
42
+ plotting code).
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mateusz Janowski, Jakub Grzyb, Gabriela Czapska
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software
14
+
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.5
2
+ Name: steam-review-analysis
3
+ Version: 0.1.0
4
+ Summary: Scrape, clean and analyse Steam community reviews.
5
+ Project-URL: Documentation, https://g-a-b-b-s.github.io/AML_APP_Steam_Reviews/
6
+ Project-URL: Repository, https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews
7
+ Project-URL: Issues, https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/issues
8
+ Project-URL: Changelog, https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/CHANGELOG.md
9
+ Author: AML APP Steam Reviews contributors
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: nlp,reviews,scraping,sentiment-analysis,steam
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
22
+ Classifier: Topic :: Text Processing :: Linguistic
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: pandas>=2.2
26
+ Provides-Extra: all
27
+ Requires-Dist: laya>=0.4.15; extra == 'all'
28
+ Requires-Dist: matplotlib>=3.9; extra == 'all'
29
+ Requires-Dist: nano-jev>=1.0.0; extra == 'all'
30
+ Requires-Dist: nltk>=3.9; extra == 'all'
31
+ Requires-Dist: numpy>=1.26; extra == 'all'
32
+ Requires-Dist: optimum-quanto>=0.2.7; extra == 'all'
33
+ Requires-Dist: scikit-learn>=1.9.1; extra == 'all'
34
+ Requires-Dist: scipy>=1.11; extra == 'all'
35
+ Requires-Dist: selenium>=4.20; extra == 'all'
36
+ Requires-Dist: torch>=2.4; extra == 'all'
37
+ Requires-Dist: transformers>=4.44; extra == 'all'
38
+ Requires-Dist: wordcloud>=1.9.3; extra == 'all'
39
+ Provides-Extra: analysis
40
+ Requires-Dist: matplotlib>=3.9; extra == 'analysis'
41
+ Requires-Dist: nltk>=3.9; extra == 'analysis'
42
+ Requires-Dist: numpy>=1.26; extra == 'analysis'
43
+ Requires-Dist: scikit-learn>=1.9.1; extra == 'analysis'
44
+ Requires-Dist: scipy>=1.11; extra == 'analysis'
45
+ Requires-Dist: wordcloud>=1.9.3; extra == 'analysis'
46
+ Provides-Extra: scrape
47
+ Requires-Dist: selenium>=4.20; extra == 'scrape'
48
+ Provides-Extra: sentiment
49
+ Requires-Dist: laya>=0.4.15; extra == 'sentiment'
50
+ Requires-Dist: nano-jev>=1.0.0; extra == 'sentiment'
51
+ Requires-Dist: optimum-quanto>=0.2.7; extra == 'sentiment'
52
+ Requires-Dist: torch>=2.4; extra == 'sentiment'
53
+ Requires-Dist: transformers>=4.44; extra == 'sentiment'
54
+ Description-Content-Type: text/markdown
55
+
56
+ # steam-review-analysis
57
+
58
+ [![CI](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/actions/workflows/ci.yml/badge.svg)](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/actions/workflows/ci.yml)
59
+
60
+ Collect [Steam](https://steamcommunity.com) community reviews, clean them into an
61
+ analysis-ready dataset, and analyse them: text preprocessing, word frequencies and word clouds,
62
+ VADER and transformer sentiment, before/after comparisons and statistics. Use it from the
63
+ command line or from Python.
64
+
65
+ ## Installation
66
+
67
+ Requires Python 3.11 or newer. The core install only needs pandas; heavier features are
68
+ optional extras:
69
+
70
+ ```bash
71
+ pip install steam-review-analysis # read, write and clean review data
72
+ pip install "steam-review-analysis[scrape]" # + scraper (Selenium; needs Google Chrome)
73
+ pip install "steam-review-analysis[analysis]" # + NLTK preprocessing, VADER, statistics, plots
74
+ pip install "steam-review-analysis[sentiment]" # + transformer sentiment models (PyTorch)
75
+ pip install "steam-review-analysis[all]" # everything
76
+ ```
77
+
78
+ A command that needs a missing extra stops with the exact `pip install` line to run.
79
+
80
+ ## Quick start
81
+
82
+ ```bash
83
+ # 1. Scrape up to 600 reviews of Terraria (app id 105600) into ./data/raw
84
+ steam-review-analysis scrape 105600 --headless
85
+
86
+ # 2. Clean all raw CSVs into ./data/processed/reviews.csv
87
+ steam-review-analysis clean
88
+
89
+ # 3. Analyse one game around a before/after cutoff date
90
+ steam-review-analysis analyse report --game 105600 --cutoff 2024-01-01
91
+ ```
92
+
93
+ The report writes word frequencies, sentiment scores, statistics, a JSON summary and plots to
94
+ `./data/processed/analysis/<game>/`, where `<game>` is the game's name from the game registry
95
+ (see below) or its app id. Run `steam-review-analysis --help`, or `--help` after
96
+ any command, for all options; `steam-review-analysis --version` prints the version.
97
+
98
+ The same steps from Python. Unlike the `analyse` commands, library functions never download
99
+ the NLTK corpora themselves, so install them once first (or run
100
+ `steam-review-analysis download-nltk`):
101
+
102
+ ```python
103
+ import steam_review_analysis as sra
104
+ from steam_review_analysis.analysis.nltk_resources import ensure_nltk_resources
105
+ from steam_review_analysis.analysis.report import run_analysis
106
+
107
+ ensure_nltk_resources(download=True) # one-off; a no-op once the corpora are installed
108
+
109
+ cleaned = sra.clean_reviews(sra.read_raw_reviews())
110
+ sra.write_processed(cleaned)
111
+
112
+ report = run_analysis(105600, "2024-01-01")
113
+ print(report.output_dir, sorted(report.tables))
114
+ ```
115
+
116
+ More worked examples will live in the Jupyter notebooks in [`notebooks/`](notebooks/). They
117
+ are not part of the installed package, and for now they hold the original per-game exploratory
118
+ analysis rather than calls to this package.
119
+
120
+ ## Commands
121
+
122
+ | Command | What it does | Extra |
123
+ | --- | --- | --- |
124
+ | `scrape [APP_ID ...]` | Scrape reviews into `<data-dir>/raw/<app_id>_reviews.csv` | `scrape` |
125
+ | `clean` | Validate, deduplicate and type all raw CSVs into `<data-dir>/processed/reviews.csv` | core |
126
+ | `analyse games` | List the games in the processed data | `analysis` |
127
+ | `analyse report` | Run the full analysis for one game and save every table and plot | `analysis` |
128
+ | `analyse preprocess \| sentiment \| frequencies \| wordcloud` | Run one analysis step | `analysis` |
129
+ | `analyse transformer-sentiment` | Score reviews with a small transformer model | `sentiment` |
130
+ | `download-nltk` | Download the NLTK corpora used by the analysis | `analysis` |
131
+
132
+ Global options work before or after the command name: `--data-dir PATH` and
133
+ `--log-level DEBUG|INFO|WARNING|ERROR`. Exit codes: `0` success, `1` workflow failure,
134
+ `2` invalid arguments, `130` interrupted with Ctrl+C.
135
+
136
+ ## Data and configuration
137
+
138
+ **Data directory.** Data is never written next to the installed package. The directory is
139
+ `--data-dir` (or the `raw_dir=` / `processed_dir=` argument in Python), otherwise the
140
+ `STEAM_REVIEW_ANALYSIS_DATA_DIR` environment variable, otherwise `./data` in the current
141
+ working directory. Inside it: `raw/`, `processed/` and `processed/analysis/<game>/`. Files are
142
+ written to a temporary file first and swapped in, so an interrupted run never leaves a
143
+ half-written dataset.
144
+
145
+ **Game registry** (optional, `./configs/games.toml` or `--games FILE`): the games scraped when
146
+ no app ids are given, and the display names added during cleaning.
147
+
148
+ ```toml
149
+ [[games]]
150
+ app_id = 105600 # the number in https://store.steampowered.com/app/<app_id>/
151
+ name = "Terraria"
152
+ ```
153
+
154
+ **Analysis presets** (optional, `./configs/presets.toml` or `--presets FILE`): a default
155
+ cutoff and game-specific word rules, selected with `--preset NAME`.
156
+
157
+ ```toml
158
+ [presets.PUBG]
159
+ app_id = 578080
160
+ cutoff = "2022-03-23"
161
+ preserve_keywords = ["pubg", "fpp", "tpp"] # kept even if they look like stopwords
162
+
163
+ [presets.PUBG.replacements] # applied after lemmatization
164
+ battlegrounds = "pubg"
165
+ hacker = "cheat"
166
+ ```
167
+
168
+ **NLTK corpora.** The `analyse` commands download missing corpora automatically. Library
169
+ functions never download anything themselves; they raise an error that names the missing
170
+ corpora. Install them once with `steam-review-analysis download-nltk`.
171
+
172
+ ## Documentation
173
+
174
+ - [Scraping and cleaning](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/docs/data_pipeline.md):
175
+ scraper options, failure behaviour and cleaning rules
176
+ - [Data schema](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/docs/data_schema.md):
177
+ every column of the raw and processed CSVs
178
+ - [Analysis and sentiment models](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/docs/analysis.md):
179
+ analysis commands, transformer models, comparing sentiment methods
180
+ - [API reference](https://g-a-b-b-s.github.io/AML_APP_Steam_Reviews/): generated from the
181
+ docstrings
182
+ - [Contributing](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/CONTRIBUTING.md)
183
+ and [changelog](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/CHANGELOG.md)
184
+
185
+ ## Responsible use
186
+
187
+ - **Steam's terms.** The scraper reads public Steam Community pages with a real browser.
188
+ You are responsible for complying with the
189
+ [Steam Subscriber Agreement](https://store.steampowered.com/subscriber_agreement/) and for
190
+ scraping at a modest rate; keep the default pauses and do not run many scrapers in parallel.
191
+ - **Personal data.** Scraped reviews are user-generated content. Store and share datasets
192
+ accordingly, and do not republish them as your own.
193
+ - **Model licenses.** The default transformer model, `nano-jev`, has weights derived from
194
+ MS MARCO, which is licensed for **non-commercial use only**. For commercial work choose an
195
+ Apache-2.0 model such as `--model laya-english`. See
196
+ [the model table](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/docs/analysis.md#transformer-sentiment).
197
+
198
+ ## License
199
+
200
+ MIT; see [LICENSE](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/LICENSE).
@@ -0,0 +1,145 @@
1
+ # steam-review-analysis
2
+
3
+ [![CI](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/actions/workflows/ci.yml/badge.svg)](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/actions/workflows/ci.yml)
4
+
5
+ Collect [Steam](https://steamcommunity.com) community reviews, clean them into an
6
+ analysis-ready dataset, and analyse them: text preprocessing, word frequencies and word clouds,
7
+ VADER and transformer sentiment, before/after comparisons and statistics. Use it from the
8
+ command line or from Python.
9
+
10
+ ## Installation
11
+
12
+ Requires Python 3.11 or newer. The core install only needs pandas; heavier features are
13
+ optional extras:
14
+
15
+ ```bash
16
+ pip install steam-review-analysis # read, write and clean review data
17
+ pip install "steam-review-analysis[scrape]" # + scraper (Selenium; needs Google Chrome)
18
+ pip install "steam-review-analysis[analysis]" # + NLTK preprocessing, VADER, statistics, plots
19
+ pip install "steam-review-analysis[sentiment]" # + transformer sentiment models (PyTorch)
20
+ pip install "steam-review-analysis[all]" # everything
21
+ ```
22
+
23
+ A command that needs a missing extra stops with the exact `pip install` line to run.
24
+
25
+ ## Quick start
26
+
27
+ ```bash
28
+ # 1. Scrape up to 600 reviews of Terraria (app id 105600) into ./data/raw
29
+ steam-review-analysis scrape 105600 --headless
30
+
31
+ # 2. Clean all raw CSVs into ./data/processed/reviews.csv
32
+ steam-review-analysis clean
33
+
34
+ # 3. Analyse one game around a before/after cutoff date
35
+ steam-review-analysis analyse report --game 105600 --cutoff 2024-01-01
36
+ ```
37
+
38
+ The report writes word frequencies, sentiment scores, statistics, a JSON summary and plots to
39
+ `./data/processed/analysis/<game>/`, where `<game>` is the game's name from the game registry
40
+ (see below) or its app id. Run `steam-review-analysis --help`, or `--help` after
41
+ any command, for all options; `steam-review-analysis --version` prints the version.
42
+
43
+ The same steps from Python. Unlike the `analyse` commands, library functions never download
44
+ the NLTK corpora themselves, so install them once first (or run
45
+ `steam-review-analysis download-nltk`):
46
+
47
+ ```python
48
+ import steam_review_analysis as sra
49
+ from steam_review_analysis.analysis.nltk_resources import ensure_nltk_resources
50
+ from steam_review_analysis.analysis.report import run_analysis
51
+
52
+ ensure_nltk_resources(download=True) # one-off; a no-op once the corpora are installed
53
+
54
+ cleaned = sra.clean_reviews(sra.read_raw_reviews())
55
+ sra.write_processed(cleaned)
56
+
57
+ report = run_analysis(105600, "2024-01-01")
58
+ print(report.output_dir, sorted(report.tables))
59
+ ```
60
+
61
+ More worked examples will live in the Jupyter notebooks in [`notebooks/`](notebooks/). They
62
+ are not part of the installed package, and for now they hold the original per-game exploratory
63
+ analysis rather than calls to this package.
64
+
65
+ ## Commands
66
+
67
+ | Command | What it does | Extra |
68
+ | --- | --- | --- |
69
+ | `scrape [APP_ID ...]` | Scrape reviews into `<data-dir>/raw/<app_id>_reviews.csv` | `scrape` |
70
+ | `clean` | Validate, deduplicate and type all raw CSVs into `<data-dir>/processed/reviews.csv` | core |
71
+ | `analyse games` | List the games in the processed data | `analysis` |
72
+ | `analyse report` | Run the full analysis for one game and save every table and plot | `analysis` |
73
+ | `analyse preprocess \| sentiment \| frequencies \| wordcloud` | Run one analysis step | `analysis` |
74
+ | `analyse transformer-sentiment` | Score reviews with a small transformer model | `sentiment` |
75
+ | `download-nltk` | Download the NLTK corpora used by the analysis | `analysis` |
76
+
77
+ Global options work before or after the command name: `--data-dir PATH` and
78
+ `--log-level DEBUG|INFO|WARNING|ERROR`. Exit codes: `0` success, `1` workflow failure,
79
+ `2` invalid arguments, `130` interrupted with Ctrl+C.
80
+
81
+ ## Data and configuration
82
+
83
+ **Data directory.** Data is never written next to the installed package. The directory is
84
+ `--data-dir` (or the `raw_dir=` / `processed_dir=` argument in Python), otherwise the
85
+ `STEAM_REVIEW_ANALYSIS_DATA_DIR` environment variable, otherwise `./data` in the current
86
+ working directory. Inside it: `raw/`, `processed/` and `processed/analysis/<game>/`. Files are
87
+ written to a temporary file first and swapped in, so an interrupted run never leaves a
88
+ half-written dataset.
89
+
90
+ **Game registry** (optional, `./configs/games.toml` or `--games FILE`): the games scraped when
91
+ no app ids are given, and the display names added during cleaning.
92
+
93
+ ```toml
94
+ [[games]]
95
+ app_id = 105600 # the number in https://store.steampowered.com/app/<app_id>/
96
+ name = "Terraria"
97
+ ```
98
+
99
+ **Analysis presets** (optional, `./configs/presets.toml` or `--presets FILE`): a default
100
+ cutoff and game-specific word rules, selected with `--preset NAME`.
101
+
102
+ ```toml
103
+ [presets.PUBG]
104
+ app_id = 578080
105
+ cutoff = "2022-03-23"
106
+ preserve_keywords = ["pubg", "fpp", "tpp"] # kept even if they look like stopwords
107
+
108
+ [presets.PUBG.replacements] # applied after lemmatization
109
+ battlegrounds = "pubg"
110
+ hacker = "cheat"
111
+ ```
112
+
113
+ **NLTK corpora.** The `analyse` commands download missing corpora automatically. Library
114
+ functions never download anything themselves; they raise an error that names the missing
115
+ corpora. Install them once with `steam-review-analysis download-nltk`.
116
+
117
+ ## Documentation
118
+
119
+ - [Scraping and cleaning](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/docs/data_pipeline.md):
120
+ scraper options, failure behaviour and cleaning rules
121
+ - [Data schema](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/docs/data_schema.md):
122
+ every column of the raw and processed CSVs
123
+ - [Analysis and sentiment models](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/docs/analysis.md):
124
+ analysis commands, transformer models, comparing sentiment methods
125
+ - [API reference](https://g-a-b-b-s.github.io/AML_APP_Steam_Reviews/): generated from the
126
+ docstrings
127
+ - [Contributing](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/CONTRIBUTING.md)
128
+ and [changelog](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/CHANGELOG.md)
129
+
130
+ ## Responsible use
131
+
132
+ - **Steam's terms.** The scraper reads public Steam Community pages with a real browser.
133
+ You are responsible for complying with the
134
+ [Steam Subscriber Agreement](https://store.steampowered.com/subscriber_agreement/) and for
135
+ scraping at a modest rate; keep the default pauses and do not run many scrapers in parallel.
136
+ - **Personal data.** Scraped reviews are user-generated content. Store and share datasets
137
+ accordingly, and do not republish them as your own.
138
+ - **Model licenses.** The default transformer model, `nano-jev`, has weights derived from
139
+ MS MARCO, which is licensed for **non-commercial use only**. For commercial work choose an
140
+ Apache-2.0 model such as `--model laya-english`. See
141
+ [the model table](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/docs/analysis.md#transformer-sentiment).
142
+
143
+ ## License
144
+
145
+ MIT; see [LICENSE](https://github.com/G-a-b-b-s/AML_APP_Steam_Reviews/blob/main/LICENSE).
@@ -0,0 +1,27 @@
1
+ # Games the scraper knows about.
2
+ # `steam-review-analysis scrape` with no arguments scrapes all of them.
3
+ # The app id is the number in https://store.steampowered.com/app/<app_id>/
4
+
5
+ [[games]]
6
+ app_id = 105600
7
+ name = "Terraria"
8
+
9
+ [[games]]
10
+ app_id = 1222670
11
+ name = "The Sims 4"
12
+
13
+ [[games]]
14
+ app_id = 578080
15
+ name = "PUBG: BATTLEGROUNDS"
16
+
17
+ [[games]]
18
+ app_id = 1172470
19
+ name = "Apex Legends"
20
+
21
+ [[games]]
22
+ app_id = 359550
23
+ name = "Tom Clancy's Rainbow Six Siege"
24
+
25
+ [[games]]
26
+ app_id = 1938090
27
+ name = "Call of Duty"
@@ -0,0 +1,62 @@
1
+ # Analysis presets used by `steam-review-analysis analyse ... --preset <NAME>`.
2
+ # Each preset sets the default before/after cutoff and the game-specific
3
+ # text-preprocessing rules (see steam_review_analysis.analysis.text.PreprocessingConfig).
4
+ #
5
+ # Keys per preset:
6
+ # app_id Steam app id (informational)
7
+ # cutoff default before/after boundary date (ISO format)
8
+ # preserve_keywords tokens kept even if they are stopwords
9
+ # replacements lemmatized-token replacements, e.g. cheater -> cheat
10
+ # extra_stopwords optional; replaces the default extra stopword list
11
+ # min_word_length optional; shortest token kept (default 2)
12
+
13
+ [presets.Counter_Strike]
14
+ app_id = 730
15
+ cutoff = "2023-09-29"
16
+ preserve_keywords = ["cs", "vac", "c4", "mm", "5v5", "1v1"]
17
+
18
+ [presets.Counter_Strike.replacements]
19
+ cheating = "cheat"
20
+ cheater = "cheat"
21
+ cheated = "cheat"
22
+ csgo = "cs"
23
+ cs2 = "cs"
24
+ go = "cs"
25
+
26
+ [presets.PUBG]
27
+ app_id = 578080
28
+ cutoff = "2022-03-23"
29
+ preserve_keywords = ["pubg", "fps", "fpp", "tpp", "mm", "solo", "squad"]
30
+
31
+ [presets.PUBG.replacements]
32
+ cheating = "cheat"
33
+ cheater = "cheat"
34
+ cheated = "cheat"
35
+ hacker = "cheat"
36
+ hack = "cheat"
37
+ aimbot = "cheat"
38
+ wallhack = "cheat"
39
+ battlegrounds = "pubg"
40
+
41
+ [presets.SIMS]
42
+ app_id = 1222670
43
+ cutoff = "2022-10-18"
44
+ preserve_keywords = ["sims", "dlc", "woohoo", "mod", "mods", "buildmode", "livemode", "cas"]
45
+
46
+ [presets.SIMS.replacements]
47
+ cheating = "cheat"
48
+ cheater = "cheat"
49
+ cheated = "cheat"
50
+ build = "buildmode"
51
+ live = "livemode"
52
+ createasim = "cas"
53
+ sim = "sims"
54
+ babies = "baby"
55
+ houses = "house"
56
+ families = "family"
57
+ expansion = "dlc"
58
+ expansions = "dlc"
59
+ pack = "dlc"
60
+ packs = "dlc"
61
+ modding = "mod"
62
+ dlcs = "dlc"