0% found this document useful (0 votes)
20 views18 pages

Unit 1: Chatbots

The document provides an overview of chatbots, artificial intelligence, and machine learning, detailing their definitions and types. It also covers programming concepts such as data types, input functions, iteration processes, and error handling in code. Additionally, it discusses software categories, data storage, CPU components, and the applications of machine learning in various fields.

Uploaded by

chi081223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views18 pages

Unit 1: Chatbots

The document provides an overview of chatbots, artificial intelligence, and machine learning, detailing their definitions and types. It also covers programming concepts such as data types, input functions, iteration processes, and error handling in code. Additionally, it discusses software categories, data storage, CPU components, and the applications of machine learning in various fields.

Uploaded by

chi081223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

UNIT 1

Chatbots
There are two main types of chatbots:
● Rule-based chatbots: Have predefined questions built-in, so they are less
conversational, the questions don’t evolve the user’s answer and are limited to the
set questions that have been programmed to be asked
● Chatbots with artificial intelligence: Intelligent conversations as the AI learns from the
user’s answer to guide the next question or offer advice. It is called machine
learning when a device learns over time.

Artificial intelligence
Definition: the ability of a computer system to learn and develop its own programming from
the experiences it encounters

Machine Learning
Definition: the ability of computer systems to learn over time

Data types
Data types Example

String Any text with more than 1 symbol like “Hello world!”

Character Any text of a single symbol like “L” or “@”

Integer Any whole number like 24 or -10

Real / Float A decimal number like 1.3

Boolean True or False values like 10 > 2 → False

How do we get a user (someone) to type information into your program?


You use an input function:

name = input(“What is your name? “)


print(name)

A variable is a name that contains some data.


Variable: name
Data type: string
To tell your computer the input will be integers/floats/boolean/etc. We have to do casting.
When you use an input function the program always thinks you are putting “words” or a
string in as data.

- If you want to input an integer: casting the input as an integer


number = int(input(“What is your favourite number? “))
print(number)

- If you want to input a float: casting the input as a float


number = float(input(“What is your height? “))
print(number)

Developing in iteration
When writing programs just like with science or anything else we have a certain way we do
it:
We follow this iterative process:
1. Requirements: Ask what is needed for the program/product to function.
2. Design: Create the algorithm (the steps the computer will follow) with a flowchart or
pseudocode; then check the pseudocode with a trace table.
3. Develop: The program code is written.
4. Test: A structured test plan is used to test if the program is functioning correctly.
5. Review:
● Fix any mistakes identified from the test plan
● Write down possible improvements for the next iteration
● Determine if the program meets the requirements from the start
● Decide if you need to iterate again
6. Launch: Release the final program.

Flowchart
Definition: aka flow diagram is a step-by-step graphical representation of a process, system
or algorithm.

START/ END

PROCESS

INPUT / OUTPUT

DECISION
Example of Python code versus Flowchart:

Python code:
num = int(input(“Enter a number”))
if num > 0:
print(“Greater than 0”)
else:
pass

Errors
Logic The program will run but does not output what is expected; an example of a
errors logic error is the inclusion of an incorrect conditional operator.

Syntax Errors in the program code stop the program from running; an example of a
errors syntax error is where the code has been typed incorrectly, for instance, missing
brackets, colons indentation or incorrect spelling, to name a few.

Runtime Errors occur while the program is running as the instructions cannot be
errors completed; an example of a runtime error is where the variable name has not
been added correctly in one aspect of the program - it would only generate an
error once it is used.

Iteration
Sequence: (normal code - line for line): A series of program instructions.
Selection: (If-else statement)

Iteration: (A loop)
A count-controlled loop is where a series of program instructions is repeated a set number
of times. Also called a for loop.
Iteration as a flowchart and pseudocode

Iteration as code and pseudocode

Sub-Routine in flowcharts and code:


Flowchart:
Code
def addition(x,y):
c=x+y
print(c)

def subtraction(a,b):
z = a-b

number1 = int(input("Enter the first number: "))


number2 = int(input("Enter the second number: "))
operation = int(input("Enter 1 for addition or 2 for subtraction: "))

if operation == 1:
addition(number1,number2)
elif operation == 2:
subtract(number1,number2)
else:
print("OUT Enter a valid number”)

Arrays
An array is a data structure that can store more than one item of data under a single
identifier (name). In Python, an array can hold only one data type, such as list = [“cat”, “dog”,
“mouse”].

How do you add to an array?

How to use a for loop in an array:

Output:

How to count the number of items in an array (list):


UNIT 2

Software

Application Software
Definition: A software designed to do a particular task.
Example: A word processor, spreadsheet, web browser, games, mobile phone apps

System software
Definition:
- Software that helps a user run a digital device.
- System software can be divided into two categories,

- Operating system
Software that manages all computer or digital devices hardware and software;
it also acts as an interface between computer hardware components and the
user and also provides a platform for which applications run.

- Utility system
Software that helps maintain the smooth functioning of a digital device by
helping the operating system manage tasks and resources

Utility software includes the following,


- Device drivers
- Security software
- Disc defragmentation

Device drivers
• Software program that operates hardware devices connected to a digital device.
• Plug-and-play devices work on digital devices due to device drivers.
• Some devices require manual installation of device drivers.

Security software
• Use of software like passwords, PINs, biometric systems.
• Implementation of firewalls.
• Use of antivirus, anti-spyware, anti-malware.

Firewalls
A firewall restricts the network traffic entering and exiting a network, to ensure that it is safe.

Antivirus
A software program that protects the computer system from viruses.

Anti-spyware
Software that detects and removes viruses from a computer.

Anti-malware
A software program that protects the computer systems from all malware

Disc defragmentation
• Disk fragmentation: scattered files on disks.
• Defragmentation: rearranging data for efficient storage.
• Used for HDDs for efficient access.

Compression tool
Makes files smaller so they are easier to transfer electronically.

Dics clean-up tool


Searches for files such as temporary files, cached web pages and rejected items that end up
in a system's recycle bin.

File-management system
Helps the user to create new files and store them on a storage device. Helps users to store
files in separate folders known as directories/folders.

Backup
Creates an exact copy of computer files, which can be used for restoring the original files in
case of file corruption, accidental/intentional deletion, or a disaster.

Security software
Any software that can secure and protect a digital device, e.g., password protection,
biometric security, or anti-malware.
Represent sound
Sound is a pressure wave that causes the air to vibrate.
This fact is used in microphones and speakers.

A computer cannot interpret an analogue sound wave as an analogue


It must be digitized and turned into binary values.
Speakers allow devices to generate sound from these binary values.
A vibrating cone causes pressure waves in the air, which you hear as sound.

Analogue sound is converted to digital format by an analogue-to-digital converter (ADC)


Digital sound is also converted to analogue by a digital-to-analogue converter (DAC)

Sample
Samples are readings that can be taken at specific time intervals and recorded.

Sampling
Sampling is the process of taking samples of a sound.

Amplitude
Amplitude indicates sound volume, with higher values representing louder sound, and is
represented by binary values.

Sample rate
The sample rate, or the number of snapshots taken each second, indicates how many
samples are collected per second.

The sample rate is measured in hertz (Hz), indicating the number of samples taken per
second.
Sample 1 = 100; Sample 2 = 101; Sample 3 = 110; Sample 20 = 011

Bit depth
Bit depth refers to the number of bits used to store each sample. A higher bit depth, along
with more samples taken, results in a better digital sound file.

Data storage
• Binary code - 1s and 0s - stores programs, operating systems, and data.
• Each binary digit (1 or 0) is a bit.
• A processor, made of transistors, is needed for data processing.
• Transistors act as switches to represent 1s and 0s.
• Grouped bits can be processed as larger units within the computer.

High-level languages (HLL)


● Programming languages that programmers easily understand.
● Examples: Python or Scratch
● Easy for humans to read, write and modify
● Uses variables to identify locations in memory for storing data
● Portable, which means it can be run by any CPU
Low-level language (LLL)
● Machine-code instructions are instructions that the processor understands.
● More difficult for humans to read, write and modify
● Identifies locations in memory using actual location addresses when storing data
● Not portable, which means it can only run on a CPU with the same instruction set

Instruction set
● CPU's own set of binary instructions. The instruction set of a CPU is written in binary
(also known as machine code).

Assembly language
● Programmers sometimes write instructions in a more easily understood version of
machine code, called an assembly language.

Interpreter
• Translates each line of HALL code into machine code.
• Carries out one instruction before translating the next, reducing main memory.
• Displays error messages immediately, aiding in debugging.
• Stops program execution when an error is encountered.
• Interprets the program each time, useful for multi-platform applications.

​Assembly
• Converting Assembly-Language Instructions to Machine Code
• Creates one line of machine code for each instruction.
• Doesn't convert the entire program in one go.
Compiler
• Translates entire program into machine code.
• Runs program only after all lines are translated.
• Reports code errors at the end, making debugging difficult.
• Takes long to compile, saves copy for reuse.
• Useful for larger programs like computer games.

Central Processing Unit (CPU)


• Runs or executes stored instructions in a computer program.
• Coordinates all computer parts during program execution.
• Comprises three main components used in program execution.

Arithmetic logic unit (ALU)


Carries out the calculations needed during the execution of a program.

Control unit (CU)


Issues commands to the other hardware components to ensure that programs are carried
out correctly.

Registers
Store data about memory locations, instructions and data used during execution of an
instruction. The different registers are:

Accumulator (ACC)
A register used by the ALU to store the results of the processing the ALU carries out
Program counter (PC)
Stores the address of the next instruction waiting to be executed (carried out) by the CPU

Current instruction register (CIR)


stores the address of the instruction the CPU is currently executing

Memory address register (MAR)


Holds the address of the memory location being accessed, either to read data from or write
data to

Memory data register (MDR)


Any data or instructions that pass into or out of main memory must pass through the MDR.

Arithmetic logic unit (ALU)


ALU carries out calculations: (arithmetic-add, subtract, etc. and logical) -i.e. compare
(number ==3)

Control unit
CU is responsible for coordinating all of the activities of the CPU. For example, it directs the
flow of data between the different components of the CPU, and between the CPU and all
other devices.

Registers
Registers - store data about memory locations, instructions, and data used during the
execution of instructions.
Three stages of CPU cycle

Logic Gates

Conditional operators
Operator Meaning

= equal to

> greater than

< less than

>= greater than or equal to

<= less than or equal to

!= not equal to
Application of machine learning

Speech input and language translation


● Many digital assistants allow users to input instructions in normal sentences by
combining machine learning with AI, enabling accurate voice command execution.
● Apps that automatically translate spoken, written, or scanned text have simplified
communication in unfamiliar languages.

Self-driving cars
● Self-driving cars use data from sensors and the internet to make choices.
● They use this data to find the best route to a destination and avoid obstacles.

Online shopping and banking


● Online shopping and banking give criminals chances to commit fraud by making fake
websites to steal login and bank details.
● Machine learning helps find unusual online activity quickly, so customers can be
warned and unauthorised actions can be stopped.

Medicine
● Medicine makers use machine learning to predict how illnesses will respond to new
drugs.
● Machine learning can analyse a lot of patient data, like scan images, to help make
accurate diagnoses and create personalised health plans.

Image recognition
● Some software uses facial recognition to let authorized users access digital devices.
● It also helps users organize photographs by content or faces.

Security
● Machine learning analyzes emails and internet activity to quickly alert authorities to
potential threats.

Route calculations
● Satellite navigation systems in cars use data from various sources, like sensors and
real-time traffic information.
● This data helps choose the fastest or most economical route for a journey.

Product targeting
● Many online stores and services collect data about users, such as websites visited,
TV shows watched, and past shopping purchases.
● This data is used to make recommendations for future purchases.
Machine learning and Artificial Intelligence
• Machine learning aids in developing AI devices, like mobile phones, understanding speech
patterns and making text message keyword recommendations.
• Some robots use machine learning for unexpected situations, like industrial settings, using
sensors and AI for safety.
• Machine learning is present in daily digital applications like internet search engines, email
filters, online banking, and biometric security systems.

Computerisation
The range of applications for machine learning and computing technology is far-reaching.
Many traditional manufacturing and industrial practices have also been computerised.

Here are some examples:

The manufacturing industry


• Traditional manufacturing employed skilled craftspeople.
• The advancement of technology led to robots replacing human workers.
• Robots needed reprogramming for new product designs.
• Computer-aided manufacturing monitors and controls the manufacturing process.
• Ensures high, consistent product production.

RFID (​​radio frequency identification)


• RFID tags track stock locations and levels for manufacturers.
• Used in checkout-free stores to automatically charge customers for selected products.
• Previously, manual task completion and stock counting were done manually.
• Automated task allows stores to decide when new products need reordering.

Chatbot
• Manage client-business communications.
• Utilize computing technology for problem-solving.
• Replace traditional staff for customer queries.

Target advertisement (cookies)


• Data collection via cookies.
• Sending targeted advertisements to potential customers.
• Previously, ads were posted publicly on roadsides, TV, and radio.

Benefits Risks
- The products produced are a better and - Technology can be expensive to purchase
more consistent quality - Costs are unknown-computers need to be
- Computers can work 24/7 repaired if they break down
- There is less chance of injury at work as - Some staff may lose their jobs
fewer humans are involved in the workplace

Prototype
Purpose of Prototypes: Prototypes are created to test new product designs and gather
feedback before finalizing the design.

Formats of Prototypes: They can take various forms, including:

● Paper-based designs
● Computer-aided design (CAD) representations
● Physical models
● 3D models

User Testing: Prototypes allow designers and developers to test functionality and user
experience.

Decision Making: They help inform decisions on improvements and adjustments needed for
the final product.

Customer Feedback: Sometimes prototypes are shared with potential customers to gather
feedback and identify areas for enhancement.

Unit 3

Evaluating the use of models


● Model / Data model: A digital data representation of a real-life scenario; the scenario
is broken down into individual attributes, which are represented as data items in the
model.
● Data: Raw information, values, facts and figures.
● Function: Similar to a sub-routine; a mini program that can exist as part of a bigger
program.
● MIN function: Returns the lowest value in a specified range of cells in a
spreadsheet.
● MAX function: Returns the highest value in a specified range of cells in a
spreadsheet.
● COUNT function: Checks all the cells in a specified range in a spreadsheet and
outputs how many contain a numeric value.
● IF function: In a spreadsheet, this evaluates (calculates) a condition and returns
different values depending on whether it is True or False.

Spreadsheets; key formulas and creating models


● Spreadsheet: Application that uses rows and columns to organise data and carry out
calculations using that data.
● Function: Similar to a sub-routine; a mini program that can exist as part of a bigger
program.

Relational databases; linking (joining) and searching


● Database: Application that organises data for storing, processing and accessing
electronically.
● Primary key: Field in a database table that provides a unique identifier for a
record/entity.
● Query: A search for data in a database that meets specific rules or criteria.
● Criteria: Set of rules that must be met.
● Validation / Data validation: An automatic check to reduce the chance of errors
being made when data is entered into a computer system.
● Relational database: A database that stores data using two or more linked tables.
● Foreign key: When the primary key from one table appears in another table to
establish a link between two entities.
● SQL (Structured Query Language): Specialised language for accessing data in
relational databases.
● Primary Key: Field in a database table that provides a unique identifier for a
record/entity.
● Foreign Key: When the primary key from one table appears in another table to
establish a link.

You might also like