【Hacker News搬运】图表·图表即代码
-
Title: Diagrams · Diagram as Code
图表·图表即代码
Text:
Url: https://diagrams.mingrammer.com/
很抱歉,我是一个文本和信息处理的AI,无法直接访问或操作网页。因此,我无法使用JinaReader或其他工具来抓取或分析您提供的链接内容。 不过,我可以帮助您了解如何使用JinaReader这样的工具来抓取和分析网页内容,以及如何处理非中文内容进行翻译。 以下是一个使用JinaReader进行内容抓取、分析和翻译的通用步骤: 1. **设置JinaReader**: - 首先,您需要在JinaReader中创建一个任务,并指定要抓取的URL。 - 配置JinaReader以抓取所需的内容,例如文章、图片或其他媒体。 2. **抓取内容**: - 使用JinaReader的抓取功能,从指定的URL中提取所需的内容。 3. **内容分析**: - 使用JinaReader内置的分析工具,对抓取的内容进行文本分析,如关键词提取、情感分析等。 4. **处理非中文内容**: - 如果抓取的内容包含非中文内容,您可以使用JinaReader的翻译功能或集成第三方翻译API(如Google Translate API)将内容翻译成中文。 5. **总结内容**: - 使用JinaReader的分析结果,撰写一份总结报告,概述抓取内容的要点。 以下是一个简化的伪代码示例,展示了如何使用这些步骤: ```python # 伪代码,实际代码取决于JinaReader的API和功能 # 步骤1: 设置JinaReader任务 task = jina_reader.create_task(url="https://diagrams.mingrammer.com/") # 步骤2: 抓取内容 content = task.extract_content() # 步骤3: 分析内容 analysis_results = task.analyze_content(content) # 步骤4: 翻译非中文内容 translated_content = task.translate_to_chinese(content) # 步骤5: 总结内容 summary = task.summarize_content(translated_content) # 输出总结 print(summary)
请注意,实际实现时需要根据JinaReader的具体API和功能进行调整。如果您需要具体的代码实现,建议查阅JinaReader的官方文档或API参考。
## Post by: ulrischa ### Comments: **tbiehn**: This project (and others like it) are graphviz wrappers - they do some really cool stuff to emit styled .dot files that look better than writing and rendering raw gv.#<p>Allowing specification in Python offers very little advantage - in theory you think, hey, I've got hi-lighting, autocompletion, and so on from an IDE. It'll play nice in VCS. Maybe I can interrogate orchestration layers and so on to produce dynamic views.<p>In practice diagrams are produced by folks who might not want to use or learn python [or golang, their other implementation]. Instead a lean purpose-build DSL, maybe even an extension of graphviz dot, is easier and more portable for some audiences to pick up. Secondly, we can't JUST graft a DSL front-end onto these tools because the styled components are baked into the project.<p>My personal experience with layout engines is that they work OK for very small architecture diagrams, but become ugly or inelegant at useful scales.<p>I (and the teams I've worked with) settle on draw.io, either the desktop app, or committed as part of confluence, as the best way to describe intent/design - and rendering graphviz with a style up top for anything dynamic.<p>Would welcome seeing a true extension to the dot language that can unlock reasoning engines (like to do threat modeling) and render-time styling. > **tbiehn**: 这个项目(以及其他类似的项目)是graphviz包装器——它们做了一些非常酷的事情来生成样式化的.dot文件,这些文件看起来比编写和渲染原始gv更好#<p> 允许Python中的规范几乎没有什么优势——理论上你会想,嘿,我;我从IDE中获得了高亮度、自动补全等功能。它;我会在VCS上打得很好。也许我可以查询编排层等以生成动态视图<p> 在实践中,图表是由那些可能不想使用或学习python(或他们的另一种实现golang)的人制作的。相反,一个精简的专用DSL,甚至可能是graphviz-dot的扩展,对一些受众来说更容易上手,也更便于携带。其次,我们可以;t只需将DSL前端移植到这些工具上,因为样式化的组件已经融入到项目中<p> 我对布局引擎的个人经验是,它们适用于非常小的架构图,但在有用的尺度上会变得丑陋或不雅<p> 我(和我合作过的团队)决定使用draw.io,无论是桌面应用程序,还是作为汇流的一部分,作为描述意图的最佳方式;设计和渲染graphviz,具有任何动态的样式<p> 欢迎看到点语言的真正扩展,可以解锁推理引擎(如进行威胁建模)并呈现时间样式。 **j4mie**: Previous discussion: <a href="https://news.ycombinator.com/item?id=31849787">https://news.ycombinator.com/item?id=31849787</a><p>Repeating my comment from that thread:<p><pre><code> from diagrams import Diagram from diagrams.aws.compute import EC2 with Diagram("Simple Diagram"): EC2("web") </code></pre> This has a very odd API. It's using (abusing?) context managers and contextvars to do weird spooky things that you could just as easily do with ordinary objects or functions. > **j4mie**: 之前的讨论:<a href=“https:/;news.ycombinator.com/;item?id=31849787”>https:"/;news.ecombinator.com;项目?id=31849787</a><p>重复我在该线程中的评论:<p><pre><code>从图表导入图表从diagrams.aws.com计算机导入EC2带有图表(“简单图表”):EC2(“网络”)</code></pre>这有一个非常奇怪的API。它;s使用(滥用?)上下文管理器和上下文变量来做奇怪的怪异的事情,你可以用普通的对象或函数轻松地做这些事情。 **aren55555**: I personally have been using mermaid for sequence diagrams and flow charts: <a href="https://mermaid.js.org/" rel="nofollow">https://mermaid.js.org/</a><p>DaC seems nicer for infra > **aren55555**: 我个人一直在使用mermaid绘制序列图和流程图:<a href=“https:”mermaid.js.org:“rel=”nofollow“>https:”/;mermaid.js.org</a> <p>DaC似乎更适合基础设施 **afandian**: Interesting decision to implement a DSL in a programming language when the output is a static data structure. Seems more complex than writing the structure directly as YML or JSON (or a custom language like Mermaid or DOT).<p>I can see the point of DSLs where the output is used by other code (e.g. builder pattern, LINQ). But this seems like overhead compared with the alternative? > **afandian**: 当输出是静态数据结构时,在编程语言中实现DSL是一个有趣的决定。这似乎比直接将结构写成YML或JSON(或像Mermaid或DOT这样的自定义语言)更复杂<p> 我可以看到DSL的输出被其他代码(例如构建器模式、LINQ)使用的地方。但与另一种选择相比,这似乎是开销? **stego-tech**: Oh <i>heck yes</i>, this is absolutely my jam. I <i>loathe</i> digging around in Visio/LucidChart/etc because I am an <i>absolute perfectionist</i> with OCD-enhanced symmetry mandates, which is just a mouthy way of saying I spend way too much time obsessing over placement details and line thickness instead of just diagramming the dang architecture.<p>Bonus points it's running via Python, which gives me a reason to fire it up and kill two birds with one stone (I'm a PowerShell junkie, so my relationship to Python thus far has been "reluctantly professional"). > **stego-tech**: 哦,是的,这绝对是我的果酱。我<I>讨厌</I>在Visio中四处挖掘;LucidChart;等等,因为我是一个绝对的完美主义者,有强迫症增强的对称性要求,这只是一种口头上的说法,说我花了太多时间痴迷于布局细节和线条粗细,而不仅仅是绘制dang架构<p> 额外加分';s通过Python运行,这给了我一个理由来启动它,一举两得(我是一个PowerShell迷,所以到目前为止,我与Python的关系一直是“不情愿的专业”)。