A simple project for analyzing Chinese novels. All data is crawled from 红袖读书
- Python: Flask, Pyecharts, statsmodels
- Node.js: Bun, Vite, React, Ant Design
- Database: Json, CSV
Main UI for the dashboard:
anal
: Analysis scriptsdata
: Data directorydatabase
: database scriptcrawl
: Crawler scriptsfetch
: Basic info for api scriptsweb
: Frontend dashboard
Data can be crawled from the script in the following steps. After running the crawler script, the data will be saved in the data
directory.
The repository Novel Data also contains the data, which has been a submodule part of this project.
Clone the repository:
git clone https://github.com/cworld1/novel-analysis.git
# If you wang to also get data, you can also clone the submodule
# git clone https://github.com/cworld1/novel-analysis.git --recurse-submodules
cd novel-analysis
Environment requirements:
- Python: 3.8+
-
Create a virtual environment:
python -m venv .venv source .venv/bin/activate
Or you can use tools for your own:
-
Install the dependencies:
pip install -r requirements.txt
-
Run crawler script (if needed)
python ./crawl/main.py
-
Run the server script
python ./api.py # or run: python -m flask --app ./api.py run
Environment requirements:
-
Install dependencies:
bun install
-
Start the development server:
bun dev
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
-
Some useful commands:
bun build
: Bundles the app into static files for production.bun lint
: Lints the project for potential errors.bun preview
: Preview the production build locally.
To spend more time coding and less time fiddling with whitespace, this project uses code conventions and styles to encourage consistency. Code with a consistent style is easier (and less error-prone!) to review, maintain, and understand.
If the style guide is not explicit about a particular situation, the cardinal rule is to be consistent. For example, take a look at the surrounding code and follow its lead, or look for similar cases elsewhere in the codebase.
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptions
property like this:
export default {
// other rules...
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname,
},
};
- Replace
plugin:@typescript-eslint/recommended
toplugin:@typescript-eslint/recommended-type-checked
orplugin:@typescript-eslint/strict-type-checked
- Optionally add
plugin:@typescript-eslint/stylistic-type-checked
- Install eslint-plugin-react and add
plugin:react/recommended
&plugin:react/jsx-runtime
to theextends
list
This project is licensed under the GPL 3.0 License.