Unit 5
Unit 5
INTELLIGENCE
B. Keerthana
Assistant Professor
CSE department
GVPCE(A)
UNIT-5
1. DATA PREPROCESSING
2. ALGORITHM DEVELOPMENT
1. DATA PREPROCESSING
● Stop word: Common words are removed from text. Words like ‘the’, ‘is’, ‘a’ have
less value and add noise to the text data.
1. DATA PREPROCESSING (Cont..)
● Lemmatization: It does the same thing as stemming, converting a word to its root
form but with one difference. For example, the word “caring” would map to ‘care’
and not ‘car’ in case of stemming.
● N-Grams: These are the combination of multiple words used together.
2. Algorithm Development:
● A parser in NLP uses the grammar rules to verify if the input text is valid or not
syntactically.
● The parser helps us to get the meaning of the provided text (like the dictionary
meaning of provided text).
● As the parser helps us to analyze the syntax error in the text; so the parsing process
is also known as the syntax analysis or the Syntactic analysis.
Types of Parsers
TOP-DOWN PARSING:
● It is the process of construction the parse tree starting at the root and proceeds
towards the leaves.
● In top down parsing words of the sentence are replaced by their categories
like verb phrase (VP), Noun phrase (NP), Preposition phrase (PP), Pronoun
(PRO) etc.
TOP-DOWN PARSING (cont..)
● In this parsing technique the process begins with the sentence and the words of
the sentence is replaced by their relevant symbols.
● In bottom up parsing the construction of parse tree starts at the leaves and
proceeds towards the root.
BOTTOM-UP PARSING:
3. Polysemy: Polysemy is a Greek word, that means “many signs”. It is a word or phrase with a
different but related sense. In other words, we can say that polysemy has the same spelling but
different and related meanings.
● For Example: The word "Bank" is a Polysemy word. The word “Bank” is a polysemy word
having the following meanings: “A financial institution”.”The building in which such an
institution is located”. “A synonym for “to rely on” “.
4. Synonymy: It represents the relation between two lexical items of different forms but expressing
the same or a close meaning.
● For Example: ‘author/writer’, ‘fate/destiny
5. Antonymy: It is the relation between two lexical items having symmetry between their semantic
components relative to an axis.
For Examples: ‘life/death’, ‘certitude/incertitude”, ‘rich/poor’, ‘hot/cold’, ‘father/son’, ‘moon/sun’.
Meaning Representation
The semantic analysis creates a representation of the meaning of a sentence. Firstly we have
to understand the building blocks of the semantic system.
Building Blocks of Semantic System
● Entities : It represents the individual such as a particular organization, location, people’s
name, etc.
For Example: Punjab, China, Chirag, Kshitiz all are entities.
● Concepts: It represents the general category of the individuals such as a person, city, etc.
● Relations: It represents the relationship between entities and concepts.
For Example: Sentence: Ram is a person
● Predicates: It represents the verb structures.
For Example: Semantic roles and Case Grammar
Techniques of Semantic Analysis
Depending on the type of information you’d like to obtain from data, you
can use one of two semantic analysis techniques
● Semantic classification model:
a. Topic classification: It is a method for processing any text and
sorting them according to different known predefined categories on
the basis of its content.
b. sentiment analysis:It is a method for detecting the hidden sentiment
inside a text, may it be positive, negative or neural
c. Intent classification: It is a method of differentiating any text on the
basis of the intent of your customers. The customers might be
interested or disinterested in your company or services
Techniques of Semantic Analysis
Step 1: Identification
Step 2: Conceptualization
Step 3: Formalization
Step 4: Implementation
Step 5: Testing
Step 1 - Identification
● Knowledge Base – It is warehouse of special heuristics or rules, which are used directly
by knowledge, facts (productions). It has knowledge that is needed for understanding,
formulating, & problem solving.
● Working Memory – It helps to describe the current running problem and record
intermediate output. Records Intermediate Hypothesis & Decisions: 1. Plan, 2. Agenda,
3. Solution
● Inference Engine – It is heart of expert system as well as helps to manage entire
structure of expert system, and it delivers to different methodology for reasoning.
● Explanation System – It helps to trace responsibility and justify the behavior of expert
system by firing questions and answers, such as Why, How, What, Where, When, Who.
● User Interface – It allows users to insert their queries with using own Natural
Language Processing otherwise menus & graphics.
Expert System Architecture
1. User interface: It is an interface that helps a non-expert user to communicate with the
expert system to find a solution.
2. Inference Engine(Rules of Engine):
○ It applies inference rules to the knowledge base to derive a conclusion or deduce new
information. It helps in deriving an error-free solution of queries asked by the user.
○ With the help of an inference engine, the system extracts the knowledge from the
knowledge base.
○ There are two types of inference engine:
a. Deterministic Inference engine: It uses established rules and logical reasoning to
analyze information and draw conclusions, and these conclusions are assumed to
be true because they are based on the known facts and rules provided to the
engine.
b. Probabilistic Inference engine: This type of inference engine contains
uncertainty in conclusions, and based on the probability.
Inference engine uses the below modes to derive the solutions:
○ Forward Chaining:
a. It is a strategy of an expert system to answer the question, “What can happen next?”
b. the Inference Engine follows the chain of conditions and derivations and finally deduces
the outcome. It considers all the facts and rules, and sorts them before concluding to a
solution.
c. This strategy is followed for working on conclusion, result, or effect.
d. For example, prediction of share market status as an effect of changes in interest rates.
○ Backward Chaining:
a. With this strategy, an expert system finds out the answer to the question, “Why this
happened?”
b. On the basis of what has already happened, the Inference Engine tries to find out
which conditions could have happened in the past for this result.
c. This strategy is followed for finding out cause or reason.
d. For example, diagnosis of blood cancer in humans.
Components of Expert Systems
3. Knowledge base:
○ The knowledgebase is a type of storage that stores knowledge acquired from the different
experts of the particular domain.
○ The more the knowledge base, the more precise will be the Expert System.
○ It is similar to a database that contains information and rules of a particular domain or
subject.
Components of Knowledge Base
○ Factual Knowledge: The knowledge which is based on facts and accepted by knowledge
engineers comes under factual knowledge.
○ Heuristic Knowledge: This knowledge is based on practice, the ability to guess,
evaluation, and experiences.
Components of Expert Systems
○ Factual Knowledge: The knowledge which is based on facts and accepted by knowledge
engineers comes under factual knowledge.
○ Heuristic Knowledge: This knowledge is based on practice, the ability to guess,
evaluation, and experiences.
Knowledge Representation: It is used to formalize the knowledge stored in the knowledge
base using the If-else rules.
Knowledge Acquisitions: It is the process of extracting, organizing, and structuring the domain
knowledge, specifying the rules to acquire the knowledge from various experts, and store that
knowledge into the knowledge base.
Development of Expert System
Here, we will explain the working of an expert system by taking an example of MYCIN ES. Below are
some steps to build an MYCIN:
○ Firstly, ES should be fed with expert knowledge. In the case of MYCIN, human experts
specialized in the medical field of bacterial infection, provide information about the causes,
symptoms, and other knowledge in that domain.
○ The KB of the MYCIN is updated successfully. In order to test it, the doctor provides a new
problem to it. The problem is to identify the presence of the bacteria by inputting the details of a
patient, including the symptoms, current condition, and medical history.
○ The ES will need a questionnaire to be filled by the patient to know the general information about
the patient, such as gender, age, etc.
○ Now the system has collected all the information, so it will find the solution for the problem by
applying if-then rules using the inference engine and using the facts stored within the KB.
○ In the end, it will provide a response to the patient by using the user interface.
Capabilities of an Expert System
○ Advising: It is capable of advising the human being for the query of any domain from the
particular ES.
○ Provide decision-making capabilities: It provides the capability of decision making in
any domain, such as for making any financial decision, decisions in medical science, etc.
○ Demonstrate a device: It is capable of demonstrating any new products such as its
features, specifications, how to use that product, etc.
○ Problem-solving: It has problem-solving capabilities.
○ Explaining a problem: It is also capable of providing a detailed description of an input
problem.
○ Interpreting the input: It is capable of interpreting the input given by the user.
○ Predicting results: It can be used for the prediction of a result.
○ Diagnosis: An ES designed for the medical field is capable of diagnosing a disease
without using multiple components as it already contains various inbuilt medical tools.
Expert Systems vs Traditional Systems
Knowledge It use knowledge representation techniques such as uses data structures such as tables, lists, and arrays.
frames, rules, and semantic networks to represent
Representation knowledge,
Learning ability Expert systems can learn from experience and adapt to Do not have this ability and require manual
new situations reprogramming to adapt to new situations.
Human can interact with humans in a more natural way through Rely on forms and menus for interaction.
the use of natural language processing and other
Interactions advanced interfaces,
Complexity Generally more complex than traditional systems due These are typically simpler and more straightforward.
to the need to represent and reason with complex
knowledge
Domain Specificity Expert systems are designed to operate within a traditional systems can be applied to a wide range of
specific domain of knowledge or expertise domains and applications.
Rule Based Expert Systems
Inference engine
Explanation
Facility
Medical diagnosis: analyzing patient symptoms, medical history, and test results.
Financial analysis: analyze financial data and provide investment recommendations
based on market trends and risk assessments
Quality control: identify potential quality issues by analyzing data from sensors and
other sources.
Customer service: provide personalized customer service, providing recommendations
Agriculture: provide farmers with recommendations on crop management, pest
control, and other agricultural practices based on weather conditions and soil data.
Transportation: used to optimize transportation routes, reduce fuel consumption, and
improve safety by analyzing traffic patterns and other data
List of Shells and Tools
● CLIPS: A rule-based programming language used to provide a powerful set of tools for knowledge
representation and inference.
● Jess: A rule-based expert system tool that is similar to CLIPS but is based on the Java programming
language.
● Drools: A business rule management system that can be used to build complex rule-based systems for
decision-making.
● Prolog: A logic-based programming language that can be used to build expert systems for a variety of
domains.
● MATLAB: A powerful tool for developing expert systems in the field of engineering and data science.
● Rete algorithm: A pattern matching algorithm that is commonly used in expert systems to perform rule-
based reasoning.
● Neural networks: Artificial neural networks can also be used as a tool for building expert systems,
especially for domains that require pattern recognition
THE END