stanfordnlp/stanza 源码下载与部署教程

项目概述

Stanford NLP Python library for tokenization, sentence segmentation, NER, and parsing of many human languages

项目地址

https://github.com/stanfordnlp/stanza

项目页面预览

stanfordnlp/stanza preview

关键指标

  • Stars:7712
  • 主要语言:Python
  • License:Other
  • 最近更新:2026-01-14T00:16:02Z
  • 默认分支:main

本站高速下载(国内可用)

点击下载(本站镜像)
– SHA256:94f81683be475f255ea4eeef49fe9313e39a5786764e3cea1952d107b738c2ed

安装部署要点(README 精选)

Issues and Usage Q&A

To ask questions, report issues or request features 🤔, please use the GitHub Issue Tracker. Before creating a new issue, please make sure to search for existing issues that may solve your problem, or visit the Frequently Asked Questions (FAQ) page on our website.

Installation

Running Stanza

Getting Started with the neural pipeline

To run your first Stanza pipeline, simply follow these steps in your Python interactive interpreter:

>>> import stanza
>>> stanza.download('en')       # Optional: pre-download English models (Pipeline can auto-download if needed)
>>> nlp = stanza.Pipeline('en') # This sets up a default neural pipeline in English
>>> doc = nlp("Barack Obama was born in Hawaii. He was elected president in 2008.")
>>> doc.sentences[0].print_dependencies()

If you encounter requests.exceptions.ConnectionError, please try to use a proxy:

>>> import stanza
>>> proxies = {'http': 'http://ip:port', 'https': 'http://ip:port'}
>>> stanza.download('en', proxies=proxies)  # Optional: pre-download English models (Pipeline can auto-download if needed)
>>> nlp = stanza.Pipeline('en')             # This sets up a default neural pipeline in English
>>> doc = nlp("Barack Obama was born in Hawaii. He was elected president in 2008.")
>>> doc.sentences[0].print_dependencies()

The last command will print out the words in the first sentence in the input string (or Document, as it is represented in Stanza), as well as the indices for the word that governs it in the Universal Dependencies parse of that sentence (its “head”), along with the dependency relation between the words. The output should look like:

('Barack', '4', 'nsubj:pass')
('Obama', '1', 'flat')
('was', '4', 'aux:pass')
('born', '0', 'root')
('in', '6', 'case')
('Hawaii', '4', 'obl')
('.', '4', 'punct')

See our getting started guide for more details.

常用命令(从 README 提取)

pip install stanza

pip install stanza -U

conda install -c stanfordnlp stanza

通用部署说明

  1. 下载源码并阅读 README
  2. 安装依赖(pip/npm/yarn 等)
  3. 配置环境变量(API Key、模型路径、数据库等)
  4. 启动服务并测试访问
  5. 上线建议:Nginx 反代 + HTTPS + 进程守护(systemd / pm2)

免责声明与版权说明

本文仅做开源项目整理与教程索引,源码版权归原作者所有,请遵循对应 License 合规使用。

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容