Skip to main content

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

qhchina-0.0.37.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.37-py3-none-any.whl (14.5 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qhchina-0.0.37.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.37.tar.gz
Algorithm Hash digest
SHA256 589a62fdc060d7d462ee32e9dcb2786ca981e485d4d9821ab1244f76cc615eff
MD5 c187eb07854aa06173978a1d7bccfe5c
BLAKE2b-256 2b4b4964de2da43f146745ca21afac4bb14951e40280db9887ae647c1f55952c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qhchina-0.0.37-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.37-py3-none-any.whl
Algorithm Hash digest
SHA256 4ff2c95b6901a5e7b2fc56738e31373e9b1521a208ed7a0afd6cb4a9324c2596
MD5 bf1f9d0018207d43451793f21d0964ce
BLAKE2b-256 50438b6c270bc72dcd81f146552a700c7c2dfdbc2221257954d9bf976fb041c3

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