[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-huggingface--neuralcoref":3,"tool-huggingface--neuralcoref":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,52],"视频",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[14,35],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":76,"owner_twitter":72,"owner_website":77,"owner_url":78,"languages":79,"stars":96,"forks":97,"last_commit_at":98,"license":99,"difficulty_score":32,"env_os":100,"env_gpu":101,"env_ram":101,"env_deps":102,"category_tags":108,"github_topics":110,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":121,"updated_at":122,"faqs":123,"releases":153},4325,"huggingface\u002Fneuralcoref","neuralcoref","✨Fast Coreference Resolution in spaCy with Neural Networks","NeuralCoref 是一款专为 spaCy 自然语言处理框架设计的核心共指消解扩展工具。它的核心任务是解决文本中“谁指代谁”的难题，即识别并链接指向同一实体的不同表达（例如将句子中的“他”、“这位科学家”与具体人名关联起来），从而让机器更准确地理解上下文逻辑。\n\n该工具非常适合需要构建高级聊天机器人、智能问答系统或进行深度文本分析的开发者与研究人员使用。得益于其无缝集成于 spaCy 流水线的特性，用户无需搭建复杂架构即可在现有项目中快速启用共指消解功能。\n\n在技术实现上，NeuralCoref 采用了混合架构：首先利用规则引擎结合 spaCy 的词性标注、句法分析和命名实体识别能力来筛选潜在的指代提及，随后通过前馈神经网络计算每对提及之间的共指得分。这种设计既保证了处理速度，又具备了较高的准确率。目前，NeuralCoref 已准备好投入生产环境，提供针对英语优化的预训练模型，并支持可视化的在线演示，帮助开发者直观地调试和验证结果。对于希望提升 NLP 应用语境理解能力的团队来说，这是一个高效且易于上手的选择。","# ✨NeuralCoref 4.0: Coreference Resolution in spaCy with Neural Networks.\n\nNeuralCoref is a pipeline extension for spaCy 2.1+ which annotates and resolves coreference clusters using a neural network. NeuralCoref is production-ready, integrated in spaCy's NLP pipeline and extensible to new training datasets.\n\nFor a brief introduction to coreference resolution and NeuralCoref, please refer to our [blog post](https:\u002F\u002Fmedium.com\u002Fhuggingface\u002Fstate-of-the-art-neural-coreference-resolution-for-chatbots-3302365dcf30).\nNeuralCoref is written in Python\u002FCython and comes with a pre-trained statistical model for **English only**.\n\nNeuralCoref is accompanied by a visualization client [NeuralCoref-Viz](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref-viz), a web interface  powered by a REST server that can be [tried online](https:\u002F\u002Fhuggingface.co\u002Fcoref\u002F). NeuralCoref is released under the MIT license.\n\n✨ Version 4.0 out now! Available on pip and compatible with SpaCy 2.1+.\n\n[![Current Release Version](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fhuggingface\u002Fneuralcoref.svg?style=flat-square)](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref\u002Freleases)\n[![spaCy](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fmade%20with%20❤%20and-spaCy-09a3d5.svg)](https:\u002F\u002Fspacy.io)\n[![Travis-CI](https:\u002F\u002Ftravis-ci.org\u002Fhuggingface\u002Fneuralcoref.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fhuggingface\u002Fneuralcoref)\n[![NeuralCoref online Demo](https:\u002F\u002Fhuggingface.co\u002Fcoref\u002Fassets\u002Fthumbnail-large.png)](https:\u002F\u002Fhuggingface.co\u002Fcoref\u002F)\n\n- **Operating system**: macOS \u002F OS X · Linux · Windows (Cygwin, MinGW, Visual Studio)\n- **Python version**: Python 3.6+ (only 64 bit)\n- **Package managers**: [pip]\n\n## Install NeuralCoref\n\n### Install NeuralCoref with pip\n\nThis is the easiest way to install NeuralCoref.\n\n```bash\npip install neuralcoref\n```\n\n#### `spacy.strings.StringStore size changed` error\n\nIf you have an error mentioning `spacy.strings.StringStore size changed, may indicate binary incompatibility` when loading NeuralCoref with `import neuralcoref`, it means you'll have to install NeuralCoref from the distribution's sources instead of the wheels to get NeuralCoref to build against the most recent version of SpaCy for your system.\n\nIn this case, simply re-install neuralcoref as follows:\n\n```bash\npip uninstall neuralcoref\npip install neuralcoref --no-binary neuralcoref\n```\n\n#### Installing SpaCy's model\n\nTo be able to use NeuralCoref you will also need to have an English model for SpaCy.\n\nYou can use whatever english model works fine for your application but note that the performances of NeuralCoref are strongly dependent on the performances of the SpaCy model and in particular on the performances of SpaCy model's tagger, parser and NER components. A larger SpaCy English model will thus improve the quality of the coreference resolution as well (see some details in the [Internals and Model](#-Internals-and-Model) section below).\n\nHere is an example of how you can install SpaCy and a (small) English model for SpaCy, more information can be found on [spacy's website](https:\u002F\u002Fspacy.io\u002Fusage\u002Fmodels):\n\n```bash\npip install -U spacy\npython -m spacy download en\n```\n\n### Install NeuralCoref from source\n\nYou can also install NeuralCoref from sources. You will need to install the dependencies first which includes Cython and SpaCy.\n\nHere is the process:\n\n```bash\nvenv .env\nsource .env\u002Fbin\u002Factivate\ngit clone https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref.git\ncd neuralcoref\npip install -r requirements.txt\npip install -e .\n```\n\n## Internals and Model\n\nNeuralCoref is made of two sub-modules:\n\n- a rule-based mentions-detection module which uses SpaCy's tagger, parser and NER annotations to identify a set of potential coreference mentions, and\n- a feed-forward neural-network which compute a coreference score for each pair of potential mentions.\n\nThe first time you import NeuralCoref in python, it will download the weights of the neural network model in a cache folder.\n\nThe cache folder is set by defaults to `~\u002F.neuralcoref_cache` (see [file_utils.py](.\u002Fneuralcoref\u002Ffile_utils.py)) but this behavior can be overided by setting the environment variable `NEURALCOREF_CACHE` to point to another location.\n\nThe cache folder can be safely deleted at any time and the module will download again the model the next time it is loaded.\n\nYou can have more information on the location, downloading and caching process of the internal model by activating python's `logging` module before loading NeuralCoref as follows:\n\n```python\nimport logging;\nlogging.basicConfig(level=logging.INFO)\nimport neuralcoref\n>>> INFO:neuralcoref:Getting model from https:\u002F\u002Fs3.amazonaws.com\u002Fmodels.huggingface.co\u002Fneuralcoref\u002Fneuralcoref.tar.gz or cache\n>>> INFO:neuralcoref.file_utils:https:\u002F\u002Fs3.amazonaws.com\u002Fmodels.huggingface.co\u002Fneuralcoref\u002Fneuralcoref.tar.gz not found in cache, downloading to \u002Fvar\u002Ffolders\u002Fyx\u002Fcw8n_njx3js5jksyw_qlp8p00000gn\u002FT\u002Ftmp_8y5_52m\n100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 40155833\u002F40155833 [00:06\u003C00:00, 6679263.76B\u002Fs]\n>>> INFO:neuralcoref.file_utils:copying \u002Fvar\u002Ffolders\u002Fyx\u002Fcw8n_njx3js5jksyw_qlp8p00000gn\u002FT\u002Ftmp_8y5_52m to cache at \u002FUsers\u002Fthomaswolf\u002F.neuralcoref_cache\u002Ff46bc05a4bfba2ae0d11ffd41c4777683fa78ed357dc04a23c67137abf675e14.7d6f9a6fecf5cf09e74b65f85c7d6896b21decadb2554d486474f63b95ec4633\n>>> INFO:neuralcoref.file_utils:creating metadata file for \u002FUsers\u002Fthomaswolf\u002F.neuralcoref_cache\u002Ff46bc05a4bfba2ae0d11ffd41c4777683fa78ed357dc04a23c67137abf675e14.7d6f9a6fecf5cf09e74b65f85c7d6896b21decadb2554d486474f63b95ec4633\n>>> INFO:neuralcoref.file_utils:removing temp file \u002Fvar\u002Ffolders\u002Fyx\u002Fcw8n_njx3js5jksyw_qlp8p00000gn\u002FT\u002Ftmp_8y5_52m\n>>> INFO:neuralcoref:extracting archive file \u002FUsers\u002Fthomaswolf\u002F.neuralcoref_cache\u002Ff46bc05a4bfba2ae0d11ffd41c4777683fa78ed357dc04a23c67137abf675e14.7d6f9a6fecf5cf09e74b65f85c7d6896b21decadb2554d486474f63b95ec4633 to dir \u002FUsers\u002Fthomaswolf\u002F.neuralcoref_cache\u002Fneuralcoref\n```\n\n## Loading NeuralCoref\n\n### Adding NeuralCoref to the pipe of an English SpaCy Language\n\nHere is the recommended way to instantiate NeuralCoref and add it to SpaCY's pipeline of annotations:\n\n```python\n\n# Load your usual SpaCy model (one of SpaCy English models)\nimport spacy\nnlp = spacy.load('en')\n\n# Add neural coref to SpaCy's pipe\nimport neuralcoref\nneuralcoref.add_to_pipe(nlp)\n\n# You're done. You can now use NeuralCoref as you usually manipulate a SpaCy document annotations.\ndoc = nlp(u'My sister has a dog. She loves him.')\n\ndoc._.has_coref\ndoc._.coref_clusters\n```\n\n### Loading NeuralCoref and adding it manually to the pipe of an English SpaCy Language\n\nAn equivalent way of adding NeuralCoref to a SpaCy model pipe is to instantiate the NeuralCoref class first and then add it manually to the pipe of the SpaCy Language model.\n\n```python\n\n# Load your usual SpaCy model (one of SpaCy English models)\nimport spacy\nnlp = spacy.load('en')\n\n# load NeuralCoref and add it to the pipe of SpaCy's model\nimport neuralcoref\ncoref = neuralcoref.NeuralCoref(nlp.vocab)\nnlp.add_pipe(coref, name='neuralcoref')\n\n# You're done. You can now use NeuralCoref the same way you usually manipulate a SpaCy document and it's annotations.\ndoc = nlp(u'My sister has a dog. She loves him.')\n\ndoc._.has_coref\ndoc._.coref_clusters\n```\n\n## Using NeuralCoref\n\nNeuralCoref will resolve the coreferences and annotate them as [extension attributes](https:\u002F\u002Fspacy.io\u002Fusage\u002Fprocessing-pipelines#custom-components-extensions) in the spaCy `Doc`,  `Span` and `Token` objects under the `._.` dictionary.\n\nHere is the list of the annotations:\n\n|  Attribute                |  Type              |  Description\n|---------------------------|--------------------|-----------------------------------------------------\n|`doc._.has_coref`          |boolean             |Has any coreference has been resolved in the Doc\n|`doc._.coref_clusters`     |list of `Cluster`   |All the clusters of corefering mentions in the doc\n|`doc._.coref_resolved`     |unicode             |Unicode representation of the doc where each corefering mention is replaced by the main mention in the associated cluster.\n|`doc._.coref_scores`       |Dict of Dict        |Scores of the coreference resolution between mentions.\n|`span._.is_coref`          |boolean             |Whether the span has at least one corefering mention\n|`span._.coref_cluster`     |`Cluster`           |Cluster of mentions that corefer with the span\n|`span._.coref_scores`      |Dict                |Scores of the coreference resolution of & span with other mentions (if applicable).\n|`token._.in_coref`         |boolean             |Whether the token is inside at least one corefering mention\n|`token._.coref_clusters`   |list of `Cluster`   |All the clusters of corefering mentions that contains the token\n\nA `Cluster` is a cluster of coreferring mentions which has 3 attributes and a few methods to simplify the navigation inside a cluster:\n\n|  Attribute or method   |  Type \u002F Return type |  Description\n|------------------------|---------------------|-----------------------------------------------------\n|`i`                     |int                  |Index of the cluster in the Doc\n|`main`                  |`Span`               |Span of the most representative mention in the cluster\n|`mentions`              |list of `Span`       |List of all the mentions in the cluster\n|`__getitem__`           |return `Span`        |Access a mention in the cluster\n|`__iter__`              |yields `Span`        |Iterate over mentions in the cluster\n|`__len__`               |return int           |Number of mentions in the cluster\n\n### Navigating the coreference cluster chains\n\nYou can also easily navigate the coreference cluster chains and display clusters and mentions.\n\nHere are some examples, try them out to test it for yourself.\n\n```python\nimport spacy\nimport neuralcoref\nnlp = spacy.load('en')\nneuralcoref.add_to_pipe(nlp)\n\ndoc = nlp(u'My sister has a dog. She loves him')\n\ndoc._.coref_clusters\ndoc._.coref_clusters[1].mentions\ndoc._.coref_clusters[1].mentions[-1]\ndoc._.coref_clusters[1].mentions[-1]._.coref_cluster.main\n\ntoken = doc[-1]\ntoken._.in_coref\ntoken._.coref_clusters\n\nspan = doc[-1:]\nspan._.is_coref\nspan._.coref_cluster.main\nspan._.coref_cluster.main._.coref_cluster\n```\n\n**Important**: NeuralCoref mentions are spaCy [Span objects](https:\u002F\u002Fspacy.io\u002Fapi\u002Fspan) which means you can access all the usual [Span attributes](https:\u002F\u002Fspacy.io\u002Fapi\u002Fspan#attributes) like `span.start` (index of the first token of the span in the document), `span.end` (index of the first token after the span in the document), etc...\n\nEx: `doc._.coref_clusters[1].mentions[-1].start` will give you the index of the first token of the last mention of the second coreference cluster in the document.\n\n## Parameters\n\nYou can pass several additional parameters to `neuralcoref.add_to_pipe` or `NeuralCoref()` to control the behavior of NeuralCoref.\n\nHere is the full list of these parameters and their descriptions:\n\n| Parameter       | Type                    | Description\n|-----------------|-------------------------|----------------\n|`greedyness`     |float                    |A number between 0 and 1 determining how greedy the model is about making coreference decisions (more greedy means more coreference links). The default value is 0.5.\n|`max_dist`       |int                      |How many mentions back to look when considering possible antecedents of the current mention. Decreasing the value will cause the system to run faster but less accurately. The default value is 50.\n|`max_dist_match` |int                      |The system will consider linking the current mention to a preceding one further than `max_dist` away if they share a noun or proper noun. In this case, it looks `max_dist_match` away instead. The default value is 500.\n|`blacklist`      |boolean                  |Should the system resolve coreferences for pronouns in the following list: `[\"i\", \"me\", \"my\", \"you\", \"your\"]`. The default value is True (coreference resolved).\n|`store_scores`   |boolean                  |Should the system store the scores for the coreferences in annotations. The default value is True.\n|`conv_dict`      |dict(str, list(str))     |A conversion dictionary that you can use to replace the embeddings of *rare words* (keys) by an average of the embeddings of a list of *common words* (values). Ex: `conv_dict={\"Angela\": [\"woman\", \"girl\"]}` will help resolving coreferences for `Angela` by using the embeddings for the more common `woman` and `girl` instead of the embedding of `Angela`. This currently only works for single words (not for words groups).\n\n### How to change a parameter\n\n```python\nimport spacy\nimport neuralcoref\n\n# Let's load a SpaCy model\nnlp = spacy.load('en')\n\n# First way we can control a parameter\nneuralcoref.add_to_pipe(nlp, greedyness=0.75)\n\n# Another way we can control a parameter\nnlp.remove_pipe(\"neuralcoref\")  # This remove the current neuralcoref instance from SpaCy pipe\ncoref = neuralcoref.NeuralCoref(nlp.vocab, greedyness=0.75)\nnlp.add_pipe(coref, name='neuralcoref')\n```\n\n### Using the conversion dictionary parameter to help resolve rare words\n\nHere is an example on how we can use the parameter `conv_dict` to help resolving coreferences of a rare word like a name:\n\n```python\nimport spacy\nimport neuralcoref\n\nnlp = spacy.load('en')\n\n# Let's try before using the conversion dictionary:\nneuralcoref.add_to_pipe(nlp)\ndoc = nlp(u'Deepika has a dog. She loves him. The movie star has always been fond of animals')\ndoc._.coref_clusters\ndoc._.coref_resolved\n# >>> [Deepika: [Deepika, She, him, The movie star]]\n# >>> 'Deepika has a dog. Deepika loves Deepika. Deepika has always been fond of animals'\n# >>> Not very good...\n\n# Here are three ways we can add the conversion dictionary\nnlp.remove_pipe(\"neuralcoref\")\nneuralcoref.add_to_pipe(nlp, conv_dict={'Deepika': ['woman', 'actress']})\n# or\nnlp.remove_pipe(\"neuralcoref\")\ncoref = neuralcoref.NeuralCoref(nlp.vocab, conv_dict={'Deepika': ['woman', 'actress']})\nnlp.add_pipe(coref, name='neuralcoref')\n# or after NeuralCoref is already in SpaCy's pipe, by modifying NeuralCoref in the pipeline\nnlp.get_pipe('neuralcoref').set_conv_dict({'Deepika': ['woman', 'actress']})\n\n# Let's try agin with the conversion dictionary:\ndoc = nlp(u'Deepika has a dog. She loves him. The movie star has always been fond of animals')\ndoc._.coref_clusters\n# >>> [Deepika: [Deepika, She, The movie star], a dog: [a dog, him]]\n# >>> 'Deepika has a dog. Deepika loves a dog. Deepika has always been fond of animals'\n# >>> A lot better!\n```\n\n## Using NeuralCoref as a server\n\nA simple example of server script for integrating NeuralCoref in a REST API is provided as an example in [`examples\u002Fserver.py`](examples\u002Fserver.py).\n\nTo use it you need to install falcon first:\n\n```bash\npip install falcon\n```\n\nYou can then start the server as follows:\n\n```bash\ncd examples\npython .\u002Fserver.py\n```\n\nAnd query the server like this:\n\n```bash\ncurl --data-urlencode \"text=My sister has a dog. She loves him.\" -G localhost:8000\n```\n\nThere are many other ways you can manage and deploy NeuralCoref. Some examples can be found in [spaCy Universe](https:\u002F\u002Fspacy.io\u002Funiverse\u002F).\n\n## Re-train the model \u002F Extend to another language\n\nIf you want to retrain the model or train it on another language, see our [training instructions](.\u002Fneuralcoref\u002Ftrain\u002Ftraining.md) as well as our [blog post](https:\u002F\u002Fmedium.com\u002Fhuggingface\u002Fhow-to-train-a-neural-coreference-model-neuralcoref-2-7bb30c1abdfe)\n","# ✨NeuralCoref 4.0：使用神经网络在spaCy中进行共指消解。\n\nNeuralCoref 是一个适用于 spaCy 2.1 及以上版本的管道扩展，它利用神经网络标注并解析共指聚类。NeuralCoref 已经可以用于生产环境，集成到 spaCy 的 NLP 管道中，并且可以扩展到新的训练数据集。\n\n如需简要了解共指消解和 NeuralCoref，请参阅我们的 [博客文章](https:\u002F\u002Fmedium.com\u002Fhuggingface\u002Fstate-of-the-art-neural-coreference-resolution-for-chatbots-3302365dcf30)。\n\nNeuralCoref 使用 Python\u002FCython 编写，附带一个针对 **英语** 的预训练统计模型。\n\nNeuralCoref 配有一个可视化客户端 [NeuralCoref-Viz](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref-viz)，这是一个由 REST 服务器驱动的 Web 界面，您可以在 [在线试用](https:\u002F\u002Fhuggingface.co\u002Fcoref\u002F)。NeuralCoref 采用 MIT 许可证发布。\n\n✨ 版本 4.0 现已推出！可通过 pip 安装，并兼容 SpaCy 2.1 及以上版本。\n\n[![当前发布版本](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fhuggingface\u002Fneuralcoref.svg?style=flat-square)](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref\u002Freleases)\n[![spaCy](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fmade%20with%20❤%20and-spaCy-09a3d5.svg)](https:\u002F\u002Fspacy.io)\n[![Travis-CI](https:\u002F\u002Ftravis-ci.org\u002Fhuggingface\u002Fneuralcoref.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fhuggingface\u002Fneuralcoref)\n[![NeuralCoref 在线演示](https:\u002F\u002Fhuggingface.co\u002Fcoref\u002Fassets\u002Fthumbnail-large.png)](https:\u002F\u002Fhuggingface.co\u002Fcoref\u002F)\n\n- **操作系统**: macOS \u002F OS X · Linux · Windows (Cygwin, MinGW, Visual Studio)\n- **Python 版本**: Python 3.6+（仅 64 位）\n- **包管理器**: [pip]\n\n## 安装 NeuralCoref\n\n### 使用 pip 安装 NeuralCoref\n\n这是安装 NeuralCoref 最简单的方式。\n\n```bash\npip install neuralcoref\n```\n\n#### `spacy.strings.StringStore size changed` 错误\n\n如果您在使用 `import neuralcoref` 加载 NeuralCoref 时遇到 `spacy.strings.StringStore size changed, may indicate binary incompatibility` 的错误，这意味着您需要从源代码而非二进制包安装 NeuralCoref，以便使其与您系统上最新版本的 SpaCy 进行编译。\n\n在这种情况下，只需按以下步骤重新安装：\n\n```bash\npip uninstall neuralcoref\npip install neuralcoref --no-binary neuralcoref\n```\n\n#### 安装 SpaCy 模型\n\n要使用 NeuralCoref，您还需要一个 SpaCy 的英语模型。\n\n您可以根据应用需求选择任何合适的英语模型，但请注意，NeuralCoref 的性能高度依赖于 SpaCy 模型的表现，尤其是其词性标注、句法分析和命名实体识别组件的性能。因此，使用更大的 SpaCy 英语模型将有助于提升共指消解的质量（详情请参阅下方的“内部机制与模型”部分）。\n\n以下是如何安装 SpaCy 和一个小型英语模型的示例，更多信息请访问 [SpaCy 官网](https:\u002F\u002Fspacy.io\u002Fusage\u002Fmodels)：\n\n```bash\npip install -U spacy\npython -m spacy download en\n```\n\n### 从源码安装 NeuralCoref\n\n您也可以从源码安装 NeuralCoref。首先需要安装依赖项，包括 Cython 和 SpaCy。\n\n具体步骤如下：\n\n```bash\nvenv .env\nsource .env\u002Fbin\u002Factivate\ngit clone https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref.git\ncd neuralcoref\npip install -r requirements.txt\npip install -e .\n```\n\n## 内部机制与模型\n\nNeuralCoref 由两个子模块组成：\n\n- 基于规则的提及检测模块，它利用 SpaCy 的词性标注、句法分析和命名实体识别结果来识别潜在的共指提及；\n- 一个前馈神经网络，用于为每对潜在提及计算共指得分。\n\n首次在 Python 中导入 NeuralCoref 时，它会将神经网络模型的权重下载到缓存文件夹中。\n\n默认情况下，缓存文件夹设置为 `~\u002F.neuralcoref_cache`（参见 [file_utils.py](.\u002Fneuralcoref\u002Ffile_utils.py)），但您可以通过设置环境变量 `NEURALCOREF_CACHE` 来指定其他位置以覆盖此行为。\n\n缓存文件夹可以随时安全删除，下次加载模块时会重新下载模型。\n\n您可以通过在加载 NeuralCoref 之前激活 Python 的 `logging` 模块来获取有关内部模型位置、下载和缓存过程的更多信息，方法如下：\n\n```python\nimport logging;\nlogging.basicConfig(level=logging.INFO)\nimport neuralcoref\n>>> INFO:neuralcoref:Getting model from https:\u002F\u002Fs3.amazonaws.com\u002Fmodels.huggingface.co\u002Fneuralcoref\u002Fneuralcoref.tar.gz or cache\n>>> INFO:neuralcoref.file_utils:https:\u002F\u002Fs3.amazonaws.com\u002Fmodels.huggingface.co\u002Fneuralcoref\u002Fneuralcoref.tar.gz not found in cache, downloading to \u002Fvar\u002Ffolders\u002Fyx\u002Fcw8n_njx3js5jksyw_qlp8p00000gn\u002FT\u002Ftmp_8y5_52m\n100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 40155833\u002F40155833 [00:06\u003C00:00, 6679263.76B\u002Fs]\n>>> INFO:neuralcoref.file_utils:copying \u002Fvar\u002Ffolders\u002Fyx\u002Fcw8n_njx3js5jksyw_qlp8p00000gn\u002FT\u002Ftmp_8y5_52m to cache at \u002FUsers\u002Fthomaswolf\u002F.neuralcoref_cache\u002Ff46bc05a4bfba2ae0d11ffd41c4777683fa78ed357dc04a23c67137abf675e14.7d6f9a6fecf5cf09e74b65f85c7d6896b21decadb2554d486474f63b95ec4633\n>>> INFO:neuralcoref.file_utils:creating metadata file for \u002FUsers\u002Fthomaswolf\u002F.neuralcoref_cache\u002Ff46bc05a4bfba2ae0d11ffd41c4777683fa78ed357dc04a23c67137abf675e14.7d6f9a6fecf5cf09e74b65f85c7d6896b21decadb2554d486474f63b95ec4633\n>>> INFO:neuralcoref.file_utils:removing temp file \u002Fvar\u002Ffolders\u002Fyx\u002Fcw8n_njx3js5jksyw_qlp8p00000gn\u002FT\u002Ftmp_8y5_52m\n>>> INFO:neuralcoref:extracting archive file \u002FUsers\u002Fthomaswolf\u002F.neuralcoref_cache\u002Ff46bc05a4bfba2ae0d11ffd41c4777683fa78ed357dc04a23c67137abf675e14.7d6f9a6fecf5cf09e74b65f85c7d6896b21decadb2554d486474f63b95ec4633 to dir \u002FUsers\u002Fthomaswolf\u002F.neuralcoref_cache\u002Fneuralcoref\n```\n\n## 加载 NeuralCoref\n\n### 将 NeuralCoref 添加到英语 SpaCy 语言模型的管道中\n\n以下是实例化 NeuralCoref 并将其添加到 SpaCy 注释管道中的推荐方法：\n\n```python\n\n# 加载您常用的 SpaCy 模型（任一 SpaCy 英语模型）\nimport spacy\nnlp = spacy.load('en')\n\n# 将 Neural Coref 添加到 SpaCy 的管道中\nimport neuralcoref\nneuralcoref.add_to_pipe(nlp)\n\n# 完成。现在您可以像操作 SpaCy 文档注释一样使用 Neural Coref。\ndoc = nlp(u'我姐姐有一只狗。她很喜欢它。')\n\ndoc._.has_coref\ndoc._.coref_clusters\n```\n\n### 手动加载 Neural Coref 并将其添加到英语 SpaCy 语言模型的管道中\n\n另一种将 Neural Coref 添加到 SpaCy 模型管道的方法是先实例化 Neural Coref 类，然后手动将其添加到 SpaCy 语言模型的管道中。\n\n```python\n\n# 加载您常用的 SpaCy 模型（任一 SpaCy 英语模型）\nimport spacy\nnlp = spacy.load('en')\n\n# 加载 NeuralCoref 并将其添加到 SpaCy 模型的管道中\nimport neuralcoref\ncoref = neuralcoref.NeuralCoref(nlp.vocab)\nnlp.add_pipe(coref, name='neuralcoref')\n\n# 完成！现在你可以像平常操作 SpaCy 文档及其标注一样使用 NeuralCoref。\ndoc = nlp(u'我姐姐有一只狗。她很喜欢它。')\n\ndoc._.has_coref\ndoc._.coref_clusters\n```\n\n## 使用 NeuralCoref\n\nNeuralCoref 会解析共指关系，并将这些信息作为 [扩展属性](https:\u002F\u002Fspacy.io\u002Fusage\u002Fprocessing-pipelines#custom-components-extensions) 注入到 SpaCy 的 `Doc`、`Span` 和 `Token` 对象中，存储在 `._.` 字典下。\n\n以下是所有标注的列表：\n\n| 属性                | 类型              | 描述\n|---------------------------|--------------------|-----------------------------------------------------\n|`doc._.has_coref`          |布尔值             |文档中是否已解析出任何共指关系\n|`doc._.coref_clusters`     |`Cluster` 列表   |文档中所有共指提及的聚类\n|`doc._.coref_resolved`     |Unicode             |文档的 Unicode 表示，其中每个共指提及都被其所属聚类中的主要提及替换。\n|`doc._.coref_scores`       |字典的字典        |提及之间共指解析的得分。\n|`span._.is_coref`          |布尔值             |该 span 是否至少包含一个共指提及\n|`span._.coref_cluster`     |`Cluster`           |与该 span 共指的提及聚类\n|`span._.coref_scores`      |字典                |该 span 与其他提及（如果适用）之间的共指解析得分。\n|`token._.in_coref`         |布尔值             |该 token 是否位于至少一个共指提及内\n|`token._.coref_clusters`   |`Cluster` 列表   |包含该 token 的所有共指提及聚类\n\n`Cluster` 是一组共指提及的聚类，具有 3 个属性和一些方法，用于简化对聚类内部的导航：\n\n| 属性或方法   | 类型 \u002F 返回类型 | 描述\n|------------------------|---------------------|-----------------------------------------------------\n|`i`                     |整数                  |聚类在文档中的索引\n|`main`                  |`Span`               |聚类中最具代表性的提及范围\n|`mentions`              |`Span` 列表       |聚类中所有提及的列表\n|`__getitem__`           |返回 `Span`        |访问聚类中的某个提及\n|`__iter__`              |生成 `Span`        |遍历聚类中的提及\n|`__len__`               |返回整数           |聚类中提及的数量\n\n### 导航共指聚类链\n\n你还可以轻松地导航共指聚类链，并展示聚类和提及。\n\n以下是一些示例，请亲自尝试以测试效果。\n\n```python\nimport spacy\nimport neuralcoref\nnlp = spacy.load('en')\nneuralcoref.add_to_pipe(nlp)\n\ndoc = nlp(u'我姐姐有一只狗。她很喜欢它')\n\ndoc._.coref_clusters\ndoc._.coref_clusters[1].mentions\ndoc._.coref_clusters[1].mentions[-1]\ndoc._.coref_clusters[1].mentions[-1]._.coref_cluster.main\n\ntoken = doc[-1]\ntoken._.in_coref\ntoken._.coref_clusters\n\nspan = doc[-1:]\nspan._.is_coref\nspan._.coref_cluster.main\nspan._.coref_cluster.main._.coref_cluster\n```\n\n**重要提示**：NeuralCoref 中的提及是 SpaCy 的 [Span 对象](https:\u002F\u002Fspacy.io\u002Fapi\u002Fspan)，这意味着你可以访问所有常规的 [Span 属性](https:\u002F\u002Fspacy.io\u002Fapi\u002Fspan#attributes)，例如 `span.start`（该 span 在文档中第一个 token 的索引）、`span.end`（该 span 后第一个 token 的索引）等。\n\n示例：`doc._.coref_clusters[1].mentions[-1].start` 将给出文档中第二个共指聚类中最后一个提及的第一个 token 的索引。\n\n## 参数\n\n你可以向 `neuralcoref.add_to_pipe` 或 `NeuralCoref()` 传递多个额外参数来控制 NeuralCoref 的行为。\n\n以下是这些参数及其说明的完整列表：\n\n| 参数       | 类型                    | 描述\n|-----------------|-------------------------|----------------\n|`greedyness`     |浮点数                    |一个介于 0 和 1 之间的数值，决定模型在做出共指决策时的“贪婪”程度（越贪婪，共指链接越多）。默认值为 0.5。\n|`max_dist`       |整数                      |在考虑当前提及的可能先行词时，系统会回溯多少个提及。降低此值会使系统运行更快，但准确性会降低。默认值为 50。\n|`max_dist_match` |整数                      |如果当前提及与其前方超过 `max_dist` 距离的提及共享名词或专有名词，则系统会考虑将两者连接起来。此时，系统将搜索距离为 `max_dist_match` 的提及。默认值为 500。\n|`blacklist`      |布尔值                  |系统是否应解析以下代词的共指关系：`[\"i\", \"me\", \"my\", \"you\", \"your\"]`。默认值为 True（解析共指）。\n|`store_scores`   |布尔值                  |系统是否应将共指得分存储在标注中。默认值为 True。\n|`conv_dict`      |字典(str, list(str))     |一个转换字典，可用于将 *稀有词*（键）的嵌入替换成一组 *常见词*（值）嵌入的平均值。例如：`conv_dict={\"Angela\": [\"woman\", \"girl\"]}` 将帮助通过使用更常见的 `woman` 和 `girl` 的嵌入来解析 `Angela` 的共指关系，而不是直接使用 `Angela` 的嵌入。目前此功能仅适用于单个单词，不适用于词组。\n\n### 如何更改参数\n\n```python\nimport spacy\nimport neuralcoref\n\n# 加载 SpaCy 模型\nnlp = spacy.load('en')\n\n# 控制参数的第一种方式\nneuralcoref.add_to_pipe(nlp, greedyness=0.75)\n\n# 控制参数的另一种方式\nnlp.remove_pipe(\"neuralcoref\")  # 移除当前的 NeuralCoref 实例\ncoref = neuralcoref.NeuralCoref(nlp.vocab, greedyness=0.75)\nnlp.add_pipe(coref, name='neuralcoref')\n```\n\n### 使用转换字典参数帮助解析稀有词\n\n以下是一个如何使用 `conv_dict` 参数来帮助解析像人名这样的稀有词共指关系的示例：\n\n```python\nimport spacy\nimport neuralcoref\n\nnlp = spacy.load('en')\n\n# 尝试在未使用转换字典之前：\nneuralcoref.add_to_pipe(nlp)\ndoc = nlp(u'迪皮卡有一只狗。她很喜欢它。这位电影明星一直喜爱动物')\ndoc._.coref_clusters\ndoc._.coref_resolved\n# >>> [迪皮卡: [迪皮卡、她、它、这位电影明星]]\n# >>> '迪皮卡有一只狗。迪皮卡很喜欢迪皮卡。迪皮卡一直喜爱动物'\n# >>> 效果并不理想...\n\n# 以下是三种添加转换字典的方法\nnlp.remove_pipe(\"neuralcoref\")\nneuralcoref.add_to_pipe(nlp, conv_dict={'迪皮卡': ['woman', 'actress']})\n\n# 或者\nnlp.remove_pipe(\"neuralcoref\")\ncoref = neuralcoref.NeuralCoref(nlp.vocab, conv_dict={'Deepika': ['woman', 'actress']})\nnlp.add_pipe(coref, name='neuralcoref')\n# 或者在 NeuralCoref 已经加入 SpaCy 管道后，通过修改管道中的 NeuralCoref 组件来实现\nnlp.get_pipe('neuralcoref').set_conv_dict({'Deepika': ['woman', 'actress']})\n\n# 让我们再次尝试使用转换字典：\ndoc = nlp(u'迪皮卡有一只狗。她爱它。这位电影明星一直很喜欢动物')\ndoc._.coref_clusters\n# >>> [迪皮卡: [迪皮卡, 她, 迪皮卡], 一只狗: [一只狗, 它]]\n# >>> '迪皮卡有一只狗。迪皮卡爱那只狗。迪皮卡一直很喜欢动物'\n# >>> 好多了！\n```\n\n## 将 NeuralCoref 用作服务器\n\n一个将 NeuralCoref 集成到 REST API 中的简单服务器脚本示例，已作为示例提供在 [`examples\u002Fserver.py`](examples\u002Fserver.py) 文件中。\n\n要使用它，您需要先安装 falcon：\n\n```bash\npip install falcon\n```\n\n然后您可以按如下方式启动服务器：\n\n```bash\ncd examples\npython .\u002Fserver.py\n```\n\n并以以下方式查询服务器：\n\n```bash\ncurl --data-urlencode \"text=我姐姐有一只狗。她爱它。\" -G localhost:8000\n```\n\n管理与部署 NeuralCoref 的方式还有很多。一些示例可以在 [spaCy Universe](https:\u002F\u002Fspacy.io\u002Funiverse\u002F) 中找到。\n\n## 重新训练模型 \u002F 扩展到其他语言\n\n如果您想重新训练模型或将其训练于另一种语言，请参阅我们的[训练说明](.\u002Fneuralcoref\u002Ftrain\u002Ftraining.md)，以及我们的[博客文章](https:\u002F\u002Fmedium.com\u002Fhuggingface\u002Fhow-to-train-a-neural-coreference-model-neuralcoref-2-7bb30c1abdfe)。","# NeuralCoref 快速上手指南\n\nNeuralCoref 是一个基于神经网络的共指消解（Coreference Resolution）工具，作为 spaCy 的管道扩展组件运行。它能够识别文本中指代同一实体的不同提及（例如：\"My sister\" 和 \"She\"），并将其聚类。该工具目前仅支持**英语**。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：macOS \u002F Linux \u002F Windows (需安装 Cygwin, MinGW 或 Visual Studio)\n*   **Python 版本**：Python 3.6+ (仅支持 64 位)\n*   **前置依赖**：\n    *   `spaCy` (版本 2.1+)\n    *   `spaCy` 英语模型 (如 `en_core_web_sm` 或更大模型，模型性能直接影响共指消解效果)\n\n> **注意**：共指消解的质量高度依赖于 spaCy 模型的词性标注器 (tagger)、句法分析器 (parser) 和命名实体识别 (NER) 组件的性能。建议至少使用中等规模的英语模型以获得更好效果。\n\n## 安装步骤\n\n### 1. 安装 spaCy 及英语模型\n\n首先安装 spaCy 并下载英语模型。国内用户若遇网络问题，可配置国内镜像源（如清华源）。\n\n```bash\n# 使用 pip 安装 spacy (可选：指定国内镜像加速)\npip install -U spacy -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 下载 spaCy 英语模型 (推荐 en_core_web_md 或 en_core_web_lg)\npython -m spacy download en_core_web_sm\n```\n\n### 2. 安装 NeuralCoref\n\n#### 方式 A：通过 pip 安装（推荐）\n\n这是最简便的安装方式。\n\n```bash\npip install neuralcoref\n```\n\n**如果遇到二进制兼容性错误**：\n若在导入时出现 `spacy.strings.StringStore size changed` 错误，说明预编译包与当前 spaCy 版本不兼容。请卸载后从源码重新构建安装：\n\n```bash\npip uninstall neuralcoref\npip install neuralcoref --no-binary neuralcoref\n```\n\n#### 方式 B：从源码安装\n\n如果您需要最新代码或进行开发调试：\n\n```bash\n# 创建虚拟环境\npython -m venv .env\nsource .env\u002Fbin\u002Factivate  # Windows 用户使用: .env\\Scripts\\activate\n\n# 克隆仓库\ngit clone https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref.git\ncd neuralcoref\n\n# 安装依赖并启用编辑模式\npip install -r requirements.txt\npip install -e .\n```\n\n## 基本使用\n\nNeuralCoref 集成在 spaCy 的处理管道中，使用后会在 `Doc`、`Span` 和 `Token` 对象中增加自定义属性（通过 `._.` 访问）。\n\n### 最简单示例\n\n以下代码演示了如何加载模型、添加 NeuralCoref 管道，并提取共指簇。\n\n```python\nimport spacy\nimport neuralcoref\n\n# 1. 加载 spaCy 英语模型\nnlp = spacy.load('en_core_web_sm')\n\n# 2. 将 NeuralCoref 添加到 spaCy 管道中\nneuralcoref.add_to_pipe(nlp)\n\n# 3. 处理文本\ndoc = nlp(u'My sister has a dog. She loves him.')\n\n# 4. 访问共指消解结果\n# 检查文档中是否存在共指关系\nprint(f\"Has coref: {doc._.has_coref}\")\n\n# 获取所有共指簇列表\nclusters = doc._.coref_clusters\nprint(f\"Number of clusters: {len(clusters)}\")\n\n# 遍历并打印每个簇的主提及 (main) 和所有提及 (mentions)\nfor cluster in clusters:\n    print(f\"Cluster main: {cluster.main}\")\n    print(f\"Cluster mentions: {[mention.text for mention in cluster.mentions]}\")\n\n# 5. 获取替换后的文本（将所有指代词替换为主提及）\nresolved_text = doc._.coref_resolved\nprint(f\"Resolved text: {resolved_text}\")\n```\n\n### 核心属性说明\n\n处理后的 `doc` 对象包含以下关键扩展属性：\n\n| 属性 | 类型 | 描述 |\n| :--- | :--- | :--- |\n| `doc._.has_coref` | boolean | 文档中是否解析出任何共指关系 |\n| `doc._.coref_clusters` | List[Cluster] | 文档中所有的共指簇列表 |\n| `doc._.coref_resolved` | str | 将共指提及替换为主提及后的完整文本 |\n| `span._.is_coref` | boolean | 该片段是否属于某个共指簇 |\n| `span._.coref_cluster` | Cluster | 包含该片段的共指簇对象 |\n\n**Cluster 对象常用属性：**\n*   `main`: 簇中最具代表性的提及（Span 对象）。\n*   `mentions`: 簇中所有提及的列表（List of Span）。","某新闻聚合平台的技术团队正在构建自动摘要系统，需要从海量英文报道中提取关键人物及其关联事件，以生成结构化的人物动态简报。\n\n### 没有 neuralcoref 时\n- **指代关系断裂**：系统无法识别\"he\"、\"the CEO\"或\"Mr. Smith\"均指向同一人，导致人物行为被割裂为多个独立片段。\n- **统计严重失真**：在计算人物提及频率时，因无法合并代词与原名，导致核心人物的热度排名被大幅低估。\n- **上下文逻辑混乱**：生成的摘要中频繁出现“他做了什么”却无前文主语的情况，读者完全无法理解事件主体。\n- **人工清洗成本高**：开发人员不得不编写大量脆弱的正则规则来匹配常见代词，维护困难且覆盖率极低。\n\n### 使用 neuralcoref 后\n- **实体集群自动归一**：neuralcoref 利用神经网络精准将文中所有指代同一实体的词汇（如\"Elon Musk\"、\"he\"、\"the entrepreneur\"）聚类为统一对象。\n- **数据洞察更精准**：基于解析后的共指簇统计提及次数，真实反映了人物在报道中的核心地位，提升了推荐算法的准确性。\n- **摘要可读性飞跃**：系统在生成摘要时能自动将模糊代词还原为具体人名，确保每句话的主语清晰明确，逻辑通顺。\n- **开发效率显著提升**：直接集成进 spaCy 流水线即可生效，无需维护复杂的规则库，轻松适配各类新闻文体。\n\nneuralcoref 通过深度学习技术消除了文本中的指代歧义，让机器真正读懂了“谁是谁”，从而大幅提升了自然语言处理任务的理解深度与应用价值。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhuggingface_neuralcoref_1cb72608.png","huggingface","Hugging Face","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fhuggingface_90da21a4.png","The AI community building the future.",null,"https:\u002F\u002Fhuggingface.co\u002F","https:\u002F\u002Fgithub.com\u002Fhuggingface",[80,84,88,92],{"name":81,"color":82,"percentage":83},"C","#555555",40.4,{"name":85,"color":86,"percentage":87},"Python","#3572A5",33.9,{"name":89,"color":90,"percentage":91},"Perl","#0298c3",25.5,{"name":93,"color":94,"percentage":95},"Shell","#89e051",0.3,2891,471,"2026-04-02T08:35:38","MIT","macOS, Linux, Windows (Cygwin, MinGW, Visual Studio)","未说明",{"notes":103,"python":104,"dependencies":105},"该工具仅支持英语模型。首次导入时会自动下载神经网络权重到缓存文件夹（默认为 ~\u002F.neuralcoref_cache），可通过环境变量 NEURALCOREF_CACHE 自定义路径。若遇到二进制不兼容错误，需从源码重新安装（pip install --no-binary）。核心ference 解析效果高度依赖所选 spaCy 英文模型的性能（特别是词性标注、句法分析和命名实体识别组件），建议使用较大的 spaCy 英文模型以获得更好效果。","3.6+ (仅支持 64 位)",[106,107],"spacy>=2.1","Cython",[109,35,16,14],"插件",[111,112,113,114,115,116,117,118,119,120],"python","machine-learning","coreference","spacy","coreference-resolution","spacy-extension","spacy-pipeline","nlp","neural-networks","pytorch","2026-03-27T02:49:30.150509","2026-04-06T18:53:45.411609",[124,129,134,139,144,149],{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},19679,"遇到 'binary incompatibility'（二进制不兼容）警告或程序崩溃怎么办？","这通常是因为 spaCy 和 neuralcoref 的版本不匹配，导致底层 Cython 结构发生变化。解决方案有两种：\n1. 降级 spaCy 到与 neuralcoref 兼容的版本（例如 spaCy 2.1.8）。\n2. 从源代码同时编译安装 spaCy 和 neuralcoref，以确保两者同步。可以使用命令：`pip install neuralcoref --no-binary neuralcoref`。\n维护者表示正在努力发布更同步的版本以解决此问题。","https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref\u002Fissues\u002F158",{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},19680,"加载模型时出现 'ExtraData: unpack(b) received extra data' 错误如何解决？","该错误通常发生在加载自定义训练的模型或模型文件损坏\u002F格式不匹配时。这往往是由于训练环境与推理环境的版本不一致（特别是 thinc 或 srsly 库）导致的。建议检查训练时使用的 neuralcoref、spacy 及相关依赖库的版本，并在推理环境中严格复现相同的版本配置。如果问题依旧，可能需要重新训练模型或确认模型文件是否完整。","https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref\u002Fissues\u002F260",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},19681,"导入 neuralcoref 时抛出 'TypeError: must be char, not unicode' 错误怎么办？","这是一个已知的兼容性问题，主要出现在旧版本的 neuralcoref（如 3.0）与特定 Python 环境（如 Python 2.7）或新版 spaCy 之间。请将 neuralcoref 升级到最新版本（4.0 或更高），该问题在最新版本中已被修复。请使用 `pip install --upgrade neuralcoref` 进行更新。","https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref\u002Fissues\u002F48",{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},19682,"预训练模型将 'us' 错误地解析为 'We' 等不准确的核心指代预测如何处理？","预训练模型在某些语境下可能表现不佳（例如将 'us' 解析为 'We'）。目前库本身没有直接的黑名单功能来禁止特定词作为指代对象。变通方法包括：\n1. 在后处理阶段手动过滤或修正这些特定的错误预测。\n2. 使用自己的数据集对模型进行微调（fine-tuning），以适应特定领域的语言习惯。\n3. 关注官方后续发布的改进版模型。","https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref\u002Fissues\u002F215",{"id":145,"question_zh":146,"answer_zh":147,"source_url":148},19683,"加载 en_coref_md 或 en_coref_lg 模型时提示 'StringStore has the wrong size, try recompiling' 怎么办？","此错误表明安装的 neuralcoref 包与当前环境中安装的 spaCy 版本存在二进制不兼容（通常是因为 spaCy 更新后改变了内部结构）。解决方法是重新编译 neuralcoref 以匹配当前的 spaCy 版本。请尝试卸载后从源码重新安装：\n`pip uninstall neuralcoref`\n`pip install neuralcoref --no-binary neuralcoref`\n确保在安装前已安装了正确的构建工具（如 Visual C++ Build Tools for Windows 或 gcc for Linux\u002FMac）。","https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref\u002Fissues\u002F103",{"id":150,"question_zh":151,"answer_zh":152,"source_url":128},19684,"如何正确安装 neuralcoref 以避免版本冲突？","为了避免版本冲突和二进制不兼容问题，推荐以下安装策略：\n1. 确保 spaCy 版本与 neuralcoref 兼容（通常建议参考官方文档的兼容性矩阵，如 spaCy 2.1.x 对应 neuralcoref 4.0）。\n2. 如果遇到兼容性问题，最佳实践是从源代码编译安装 neuralcoref，命令为：`pip install neuralcoref --no-binary neuralcoref`。\n3. 尽量在干净的虚拟环境中安装，避免与其他 NLP 库产生依赖冲突。",[154,159,164,169,174],{"id":155,"version":156,"summary_zh":157,"released_at":158},117700,"v4.0.0","- 现已在 PyPI 上发布：`pip install neuralcoref`。\n- 更简化的[安装方法](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref#install-neuralcoref)，今后应该更容易维护，并与 SpaCy 保持兼容。\n- 只使用一个模型，且只存储\u002F下载\u002F缓存指代消解模型，不再存储 SpaCy 模型：下载和存储所需空间缩小至原来的十分之一。\n- 兼容 SpaCy 2.1 及以上版本；我们可能不会为较旧的 SpaCy 版本提供向后兼容性，因为 SpaCy 2.1 对依赖结构进行了大幅优化（Inès 和 Matthew 做了非常出色的工作！详情请参阅[这里](https:\u002F\u002Fexplosion.ai\u002Fblog\u002Fspacy-v2-1)）。\n- 新增功能：引入领域知识——“转换字典”（详见自述文件中的[说明](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fneuralcoref#using-the-conversion-dictionary-parameter-to-help-resolve-rare-words)）。","2019-04-08T11:28:27",{"id":160,"version":161,"summary_zh":162,"released_at":163},117701,"3.0","- 代码已迁移到 Cython 和 Thinc，速度提升 50–100 倍。目前约为 2k WPS。\n- 移除了对发音器的处理（该功能曾阻碍与 spaCy 的更紧密集成）。\n- 重构并简化了代码。\n- 更新了文档。","2018-06-08T12:12:54",{"id":165,"version":166,"summary_zh":167,"released_at":168},117702,"2.0","- **现在可以在自己的数据集上训练 Neuralcoref 了，比如其他语言！🎉🎉**\n- 发布了我们的训练代码，并更新了代码以确保与训练代码的兼容性。\n- 更新内容及错误修复。\n- 改进了文档。","2018-03-23T14:20:11",{"id":170,"version":171,"summary_zh":172,"released_at":173},117703,"0.2","- 更新以兼容稳定的 spaCy v2\n- 改进了文档\n- 允许通过 pip 从 Git 仓库安装","2018-02-15T15:50:19",{"id":175,"version":176,"summary_zh":76,"released_at":177},117704,"0.1","2017-07-07T10:50:14"]