NewspaceGPT绘制类图

简介: NewspaceGPT绘制类图

注册一个账号,用qq邮箱,然后登录

选一个可用的Plus,不要选3.5

探索GPT

今天的主角是

开始寻梦美人鱼图表

一起来学点英语吧。

Official GPT from the Mermaid team. Generate a Mermaid diagram or chart with text including flowcharts, sequence, mind map, state, git graph, C4, class, block, Gantt chart, timeline, Sankey, user journey, entity relationship, pie chart, requirement, quadrant chart, or XY chart diagrams.

美人鱼团队的官方GPT。生成包含文本的美人鱼图或图表,包括流程图、序列图、思维导图、状态图、数字图、C4、类、块图、甘特图、时间线、Sankey、用户旅程、实体关系、饼图、需求、象限图或XY图表。

Create a flowchart for making pizza. Add emoji.

Show me inheritance using a class diagram.

Make a sequence diagram for a barista ☕

Make a mindmap of various animals with emoji.

创建制作披萨的流程图。添加表情符号。

使用类图显示继承。

为咖啡师制作序列图☕

用表情符号制作各种动物的思维导图。

我选第二个试一下

Show me inheritance using a class diagram.


To illustrate inheritance using a class diagram, we will create a simple example with a base class Animal and derived classes Dog and Cat.

Summary

  • Animal is the base class with common attributes like age and gender and methods like eat() and sleep().
  • Dog and Cat inherit from Animal and have their own specific attributes and methods.

Here’s the mermaid code for this diagram:

//mermaid
classDiagram
    Animal <|-- Dog
    Animal <|-- Cat
    class Animal {
        +int age
        +String gender
        +eat()
        +sleep()
    }
    class Dog {
        +String breed
        +bark()
    }
    class Cat {
        +String furColor
        +meow()
    }

Now, let’s render this diagram.

//mermaid
classDiagram
    Animal <|-- Dog
    Animal <|-- Cat
    class Animal {
        +int age
        +String gender
        +eat()
        +sleep()
    }
    class Dog {
        +String breed
        +bark()
    }
    class Cat {
        +String furColor
        +meow()
    }

Let’s generate and render this diagram.

You can edit and save this diagram on the MermaidChart editor.


上面这个是系统的示例。下面我们自己自定义一个类图。

自定义类图玩一下

做一个类图。基类是人,子类是男人和女人 ,女人能生孩子。能吃饭,能工作。男人,能吃饭,能工作,能站着尿尿 。基类属性,姓名,性别,年龄,女人属性,三围,老公名,孩子集合。男人属性,老婆名,体重,身高,孩子集合。孩子类也是基类的子类,属性,父亲名,母亲名,年龄,学校班级,孩子可以学习,做作业。

请用汉语。


这张类图描述了基类“人”和其子类“男人”、“女人”以及“孩子”之间的关系和属性。

总结:

  • 基类是“人”,具有属性:姓名(name)、性别(gender)、年龄(age)。
  • 子类“女人”有额外的属性:三围(measurements)、老公名(husbandName)和孩子集合(children)。
  • 子类“男人”有额外的属性:老婆名(wifeName)、体重(weight)、身高(height)和孩子集合(children)。
  • 子类“孩子”有额外的属性:父亲名(fatherName)、母亲名(motherName)、年龄(age)和学校班级(schoolClass)。
  • “女人”有方法:生孩子(giveBirth())、吃饭(eat())、工作(work())。
  • “男人”有方法:吃饭(eat())、工作(work())、站着尿尿(urinateStanding())。
  • “孩子”有方法:学习(study())、做作业(doHomework())。

这段代码创建了上述的类图:

//mermaid
classDiagram
    class Person {
        +String name
        +String gender
        +int age
        +eat()
        +work()
    }
    class Woman {
        +String measurements
        +String husbandName
        +List~Child~ children
        +giveBirth()
    }
    class Man {
        +String wifeName
        +float weight
        +float height
        +List~Child~ children
        +urinateStanding()
    }
    class Child {
        +String fatherName
        +String motherName
        +int age
        +String schoolClass
        +study()
        +doHomework()
    }
    Person <|-- Woman
    Person <|-- Man
    Person <|-- Child
    Woman "1" --> "*" Child : children
    Man "1" --> "*" Child : children

生成的类图如下:

你可以在 MermaidChart editor 编辑和保存这张图。


关于类图的补救方案

如果对图有想法先改,会改mermaid语言,你就直接改。 如果不会,就去github支持的编辑器 MermaidChart editor 。修改成你需要的样子。能节省你不少时间。

结论

生成的类图看起来还是非常专业的。对需求的理解也是非常清晰,当然前提是你要描述清晰。

打个比方,如果你的关于类的集成描述,连聪明的你的聪明的同事都没听明白,那么请不要责怪生成的图表,不合心意。

关注我,不迷路,共学习,同进步

关注我,不迷路,共学习,同进步

相关文章
|
缓存 网络协议 Linux
牛客网论坛最具争议的Linux内核成神笔记,GitHub已下载量已过百万(下)
牛客网论坛最具争议的Linux内核成神笔记,GitHub已下载量已过百万
|
11月前
|
存储 人工智能 并行计算
KTransformers:告别天价显卡!国产框架让单卡24G显存跑DeepSeek-R1 671B大模型:推理速度飙升28倍
KTransformers 是由清华大学和趋境科技联合推出的开源项目,能够优化大语言模型的推理性能,降低硬件门槛。支持在仅24GB显存的单张显卡上运行671B参数的满血版大模型。
3064 8
KTransformers:告别天价显卡!国产框架让单卡24G显存跑DeepSeek-R1 671B大模型:推理速度飙升28倍
|
10月前
|
并行计算 Ubuntu Docker
kTransformers DeepSeek R1 部署全流程指南
kTransformers DeepSeek R1 部署全流程指南
|
存储 数据安全/隐私保护 索引
设计一个完美的用户角色权限表
设计一个完美的用户角色权限表
1317 1
|
消息中间件 缓存 Java
Spring Boot最经典的20道面试题,你都会了吗?
Spring Boot最经典的20道面试题,你都会了吗?
1856 0
|
机器学习/深度学习 人工智能 监控
AutoTrain:Hugging Face 开源的无代码模型训练平台
AutoTrain 是 Hugging Face 推出的开源无代码模型训练平台,旨在简化最先进模型的训练过程。用户无需编写代码,只需上传数据即可创建、微调和部署自己的 AI 模型。AutoTrain 支持多种机器学习任务,并提供自动化最佳实践,包括超参数调整、模型验证和分布式训练。
1273 4
AutoTrain:Hugging Face 开源的无代码模型训练平台
|
安全 Java 数据库连接
Spring Boot 优雅关机时异步线程安全优化
Spring Boot 优雅关机时异步线程安全优化
513 1
|
自然语言处理
如何使用GPT-4 生成高效实用的PPT
如何使用GPT-4 生成高效实用的PPT
1073 1
|
计算机视觉
【YOLOv8改进】Inner-IoU: 基于辅助边框的IoU损失(论文笔记+引入代码)
YOLO目标检测专栏探讨了IoU损失的局限性,并提出创新改进。分析发现,不同尺度的辅助边框对高IoU和低IoU样本的回归有不同影响。因此,提出了Inner-IoU Loss,利用尺度因子ratio控制辅助边框大小以优化损失计算。实验验证了该方法能提升检测效果,增强泛化能力。创新点包括根据样本特性选择辅助边框尺度和Inner-IoU Loss的设计。更多详情见YOLO目标检测创新改进与实战案例专栏。
|
移动开发 前端开发 JavaScript
Vue2 系列:vue.config.js 参数配置
Vue2 系列:vue.config.js 参数配置
1154 2