A Python package for NLP tasks related to Chinese text.
Project description
QHChina Lab
Quantitative Humanities China Lab - A research lab and Python package for NLP tasks related to Chinese text analysis.
Repository Structure
This repository contains:
- Python Package: The
qhchinapackage for Chinese text analysis in humanities research - Lab Website: The QHChina Lab website located in the
/docsfolder with information about our research, projects, resources, and documentation
Python Package Features
- Collocation Analysis: Find significant word co-occurrences in text
- Corpus Comparison: Statistically compare different corpora
- Word Embeddings: Work with Word2Vec and other embedding models
- Text Classification: BERT-based classification and analysis
- Topic Modeling: Fast LDA implementation with Cython acceleration
Installation
pip install qhchina
Usage Examples
Topic Modeling with LDA
from qhchina.analytics import LDAGibbsSampler
# Each document is a list of tokens
documents = [
["word1", "word2", "word3"],
["word2", "word4", "word5"],
# ...
]
# Initialize and train the model
lda = LDAGibbsSampler(
n_topics=10,
iterations=500
)
lda.fit(documents)
# Get top words for each topic
for i, topic in enumerate(lda.get_topic_words(10)):
print(f"Topic {i}: {[word for word, _ in topic]}")
For more examples, see the module documentation.
Website
The lab website is built with Jekyll and includes:
- Information about the QHChina Lab and our research
- Project descriptions and updates
- Resources for Chinese humanities research
- Comprehensive documentation for the qhchina package
- Blog with updates and announcements
To run the website locally:
cd docs
bundle install
bundle exec jekyll serve
Documentation
For complete API documentation and tutorials, visit: https://mcjkurz.github.io/qhchina/
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qhchina-0.0.40.tar.gz.
File metadata
- Download URL: qhchina-0.0.40.tar.gz
- Upload date:
- Size: 14.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aabebebb187b389966e452cde2c83127fe88d981b56e889fd1cf2b2f5b1e9b30
|
|
| MD5 |
80117e2cf156a9ea55f20c5f8b0566b0
|
|
| BLAKE2b-256 |
e0f5d44974260506bee7c684b28864bacb31d7e0914577445410f1035962e3db
|
File details
Details for the file qhchina-0.0.40-py3-none-any.whl.
File metadata
- Download URL: qhchina-0.0.40-py3-none-any.whl
- Upload date:
- Size: 14.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00a6437e2436ba204b790371df4ab5344f2a35a1cd8e1802e9a02fce044e46ab
|
|
| MD5 |
7f161a102d2be929175316d513bfa421
|
|
| BLAKE2b-256 |
2b9748c1d8c13090b139440a862bf262356e5edf714878c8e5b437e1880ac683
|