A Python package for NLP tasks related to Chinese text.
Project description
QHChina
Quantitative Humanities China Lab - A Python package for NLP tasks related to Chinese text analysis.
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.
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.36.tar.gz.
File metadata
- Download URL: qhchina-0.0.36.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 |
0ff35d9a1cc06ae1f5b9e060673ae7a4c506310a9690428de445d4eb264450b1
|
|
| MD5 |
826d5ad3bb363d04762ce879ee4a212f
|
|
| BLAKE2b-256 |
349e9187f2cbcf78148acd346a7e11ff7081423d8093b5c738bed2942c4c9127
|
File details
Details for the file qhchina-0.0.36-py3-none-any.whl.
File metadata
- Download URL: qhchina-0.0.36-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 |
00f135b56e6ab1391f8a8fc6489f73ad0bd1cd53288679c1c05234ee1c35804a
|
|
| MD5 |
32a565b6ef764031e88a12bd0b8b0fc2
|
|
| BLAKE2b-256 |
e1d7a060f8c53dc6062fd8db860f0bd3ba2e83da8f00f851742f30d862ffa713
|