Skip to main content

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:

  1. Python Package: The qhchina package for Chinese text analysis in humanities research
  2. Lab Website: The QHChina Lab website located in the /docs folder 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

qhchina-0.0.38.tar.gz (14.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qhchina-0.0.38-py3-none-any.whl (14.5 MB view details)

Uploaded Python 3

File details

Details for the file qhchina-0.0.38.tar.gz.

File metadata

  • Download URL: qhchina-0.0.38.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

Hashes for qhchina-0.0.38.tar.gz
Algorithm Hash digest
SHA256 2b6087fde0882a0890badb787c2a97e3cd17514175d193cb4c1ee36ddc14318f
MD5 338c7989aa4520b9c4f6f272b3a3a97b
BLAKE2b-256 59c2c2a3a0da7d909e92625992a197eaedad8e0afb6c3fb4542635bc9cc4007a

See more details on using hashes here.

File details

Details for the file qhchina-0.0.38-py3-none-any.whl.

File metadata

  • Download URL: qhchina-0.0.38-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

Hashes for qhchina-0.0.38-py3-none-any.whl
Algorithm Hash digest
SHA256 857b9596c3004a1f375eac755daa09cffcb121d32c778074a8426658e6229c9a
MD5 f39f4b98f8995b66a790b65f111fb5db
BLAKE2b-256 030bfe8e0fab1520e0256bd4a762afa709854177eb8329220fffa6b997dc9b43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page