3.2 面向对象分析(一)名词法

Analysis Phase分析阶段

   在软件工程,分析是一种过程,把用户需求转变为系统需求

   系统规格说明,也称为逻辑结构,是开发人员眼中的系统

     已经有了哪些业务规则、业务逻辑?

     还有哪些事需要提醒客户的?

   大的、复杂系统的开发,有两种主要的分析方法

     面向功能的分析Function-oriented analysis

       concentrating on the decomposition of complex functions to simply ones.

     面向对象分析Object-oriented analysis

       identifying objects and the relationship between objects.

     在抽象层面,面向功能的分析法用得多一点

       把系统分成模块

     在模块层面,面向对象分析法用得多一点

       模块的功能如何实现?--- OOAD技术!
     从“用户的角度”到“开发人员的角度”之间的差异

      

Object Oriented Analysis 面向对象分析主要步骤

   Identifying objects 识别对象

   Organising the objects: 组织对象

     classifying the objects identified, so similar objects can later be defined in the same class.

   Identifying relationships between objects: 定义对象之间的关系

     this helps to determine inputs and outputs of an object.

   Defining operations of the objects: 定义对象的操作

     the way of processing data within an object.

     Also known as ‘responsibility assignment’

     这一步,主要在设计阶段完成

   Defining objects internally: 定义对象内部细节

     information held within the objects.
Three ways to do Object Oriented Analysis (there are more…)
   1)Conceptual model (Larman) 概念模型,又称“名词法”

     Produce a “light” class diagram

   2)Analysis model with stereotypes (Jacobson) 分析模型

     Boundaries, entities, control.

   3)CRC cards (Beck, Cunningham) CRC法,类/职责/协作

     Index cards and role playing.
   A good analyst knows more than one strategy and even may mix strategies in order to identify the objects and relationships for the design      phase.

    一个好的分析师掌握多种技术,知道如何混合使用各种技术。目标只有一个: 发现对象、定义对象之间的关系。
概念模型

   概念模型 conceptual model 表示了问题领域的的 “概念”及其关系,也称 为领域模型 ‘domain model’

   UML图形表示为 “没有定义操作的类图”

     它能够显示:概念 Concepts、概念之间的关系 Associations of concepts、概念的属性 Attributes of concepts

      

名词法定义概念类

   名词法定义概念(conceptual class)

     重用或者修改已有的模型 Reuse or modify existing models.

       This is the first, best, and usually easiest approach

     借助行业、公司内部法的“概念类列表 ” Concept Category List

     在需求描述中查寻名词(短语)Finding Concepts with Noun Phrase Identification.

 


    复习: 面向对象分析与结构化分析方法之间的最大差异是 A central distinction between object oriented and structures analysis:

       前者根据对象划分系统,而后者根据功能 division by concepts (objects) rather than division by functions.
概念类列表 The Concept Category List Table

  

Finding Concepts with Noun Phrase Identification 名词短语法

   方法

     在问题领域的文本描述中,标识出名词、名词短语,把它们作为候选的概念类或者属性 Identify the noun and noun phrases in textual         descriptions of a problem domain and consider them as candidate concepts or attributes

     对发现的名称(短语)进行分析,辨别是合适的概念类吗?概念可以合并吗?等等

     定义概念类之间的关系

     定义概念类的属性

   注意

     不能机械地转换“名称 ----> 概念类”

     自然语言描述的文字有歧义、重复、一词多意、一意多词等,要仔细分析

     比如英语,复数一般就不需要了,students\student, 只要student即可
小结

   领域(用户的角度)、系统(开发人员的角度)

   概念模型 == 领域模型  概念类 == 领域概念

   如何寻找、定义领域内的概念类?

   方法一:名称法

     利用已有

     查找概念类列表

     从问题描述中寻找名词、名词短语,进行分析

   方法二:分析模型法

   方法三:CRC法

转载于:https://www.cnblogs.com/mayZhou/p/10536674.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用Python中的自然语言处理工具NLTK(Natural Language Toolkit)来实现这个功能。具体步骤如下: 1. 导入必要的库和数据 ```python import nltk from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.cluster import KMeans # 示例文本数据 text = "Natural language processing (NLP) is a subfield of linguistics, computer science, and artificial intelligence concerned with the interactions between computers and human language, in particular how to program computers to process and analyze large amounts of natural language data." ``` 2. 对文本进行分词、去停用词、词形还原等预处理操作 ```python # 分词 tokens = word_tokenize(text) # 去除停用词 stop_words = set(stopwords.words('english')) filtered_tokens = [token for token in tokens if token.lower() not in stop_words] # 词形还原 lemmatizer = WordNetLemmatizer() lemmatized_tokens = [lemmatizer.lemmatize(token) for token in filtered_tokens] ``` 3. 对处理后的文本进行TF-IDF向量化 ```python vectorizer = TfidfVectorizer() tfidf = vectorizer.fit_transform([" ".join(lemmatized_tokens)]) ``` 4. 使用K-Means算进行聚 ```python # 定义数量 k = 2 # 进行K-Means聚 kmeans = KMeans(n_clusters=k, random_state=0) kmeans.fit(tfidf) # 获取各簇中心 centers = kmeans.cluster_centers_ # 获取各簇中的关键词 indices = centers.argsort()[:, ::-1] features = vectorizer.get_feature_names() cluster_keywords = [] for i in range(k): cluster_keywords.append([features[ind] for ind in indices[i, :5]]) ``` 这样,就可以得到分簇后每个簇中的关键词了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值