Notes, summaries, assignments, exams, and problems for Other courses

Sort by
Subject
Level

NLP Techniques: Text Generation, Semantic Search & More

Classified in Electronics

Written on in English with a size of 3.92 KB

Preprocessing the Dataset

a. Normalize the Text

Python

import re
from nltk.tokenize import word_tokenize
import nltk
nltk.download('punkt')

# Preprocessing Function
def preprocess(text):
    text = re.sub(r'[^a-z\s]', '', text.lower())
    return word_tokenize(text)

# Apply Preprocessing
df['Processed'] = df['Sentence'].apply(preprocess)
print(df)


GPT-2 Text Generation

Python

from transformers import pipeline

# Load GPT-2 Model for Text Generation
generator = pipeline('text-generation', model='gpt2')

# Generate Text for a Given Prompt
prompt = "Once upon a time"
result = generator(prompt, max_length=50,
    num_return_sequences=1)
print(result[0]['generated_text'])


GPT-2 for AI Prompts

a. Prompt 1 - Future of AI

Python

prompt = "What is the future
... Continue reading "NLP Techniques: Text Generation, Semantic Search & More" »

Crafting Story Adaptations

Classified in Spanish

Written on in English with a size of 4.3 KB

Story Adaptation Techniques

Structure

  • 1. Introduction: Set the scene or context.
    • Generic phrases:
    • It was a [description] day, and I felt [emotion].
    • I had no idea what was about to happen.
    • The moment I stepped off the plane, I knew this was going to be a special journey.
  • 2. Development: Introduce the main problem or surprising situation.
    • Change the context and the details based on the topic.
    • Example: If the story is about an elephant from Africa that loses a tusk on a plane:
    • As the plane took off, [character] felt a strange sensation in his tusk.
  • 3. Conclusion: End with a resolution or reflection.
    • Generic phrases:
    • In the end, I realized [reflection].
    • That day taught me something I’ll never forget.
    • Now, looking back, I understand why it happened.

Example

Original:

... Continue reading "Crafting Story Adaptations" »

English Vocabulary with Translations, Phrasal Verbs & Word Families

Classified in Arts and Humanities

Written on in English with a size of 4.86 KB

Vocabulary: Words, Phrasal Verbs & Word Families

Headwords with Translations

  • unique (unusual, special)
  • Random (aleatorio)
  • stands out (destaca, más impresionante)
  • attached (adjunta, connected to)
  • claims
  • recall (remember)

Phrasal Verbs & Common Expressions

  • sign up for (matricularse en)
  • carry out (realizar)
  • cope with (enfrentarse con)
  • figure out (averiguar)
  • brought up (educar)
  • comes up with (inventar / pensar algo)
  • fall for (creer)
  • keep up with (seguir)
  • put up with (soportar — alguien)
  • run out of (quedarse sin — energía)

Additional Vocabulary and Usage

  • Ban (prohibit)
  • conscious (aware)
  • convince (persuade)
  • eventually (in the end)
  • fascinating (very interesting)
  • key (important)
  • significance (importance)
  • waste (desperdiciar)

Phrases for Planning, Decisions &

... Continue reading "English Vocabulary with Translations, Phrasal Verbs & Word Families" »

Animal Cell Structure, Tissues, Organ Systems, and Immunity

Classified in Biology

Written on in English with a size of 64.4 KB

Animal Eukaryotic Cells and Organelles

  • Nucleus: Holds genetic material. Protected by a double membrane that separates it from the cytoplasm.

  • Vacuoles: Small sacs that store different substances.

  • Lysosomes: Made by the Golgi apparatus; digest materials inside the cell.

  • SER (Smooth Endoplasmic Reticulum): Produces lipids and helps remove toxic substances.

  • Mitochondria: Have two membranes; break down glucose to release energy (cellular respiration).

  • Cytoplasm: Jelly-like fluid with the cytoskeleton that supports and gives shape to the cell.

  • RER (Rough Endoplasmic Reticulum): Stores and transports proteins made by ribosomes attached to it.

  • Ribosomes: Smallest organelles, no membrane; make proteins, free or attached to RER.

  • Cell membrane: Made of lipids

... Continue reading "Animal Cell Structure, Tissues, Organ Systems, and Immunity" »

Practical Machine Learning Labs in TensorFlow and PyTorch

Posted by Anonymous and classified in Computers

Written on in English with a size of 14.76 KB

Lab 1: Basic TensorFlow Computation Graph

This example demonstrates how to define and execute a simple computation graph in TensorFlow using the @tf.function decorator, which converts a Python function into a high-performance TensorFlow graph.

import tensorflow as tf

# Define a simple computation graph
@tf.function  # Converts Python function into a TensorFlow graph
def my_graph(x, y):
  return x * y + 5  # Simple equation: (x * y) + 5

# Create TensorFlow constants (nodes)
x = tf.constant(3.0)
y = tf.constant(4.0)

# Run the computation graph
result = my_graph(x, y)

# Print the result
# Convert tensor to a NumPy array to see the value
print(f"Result of (x * y) + 5: {result.numpy()}")

Lab 2: Simple Linear Regression with Keras

Here, we build,... Continue reading "Practical Machine Learning Labs in TensorFlow and PyTorch" »

English Language Essentials for Spanish Speakers

Classified in Arts and Humanities

Written on in English with a size of 5.76 KB

Essential English Vocabulary

  • Arranged marriage: Matrimonio concertado
  • Be in tears / Be close to tears / Burst into tears: Estar llorando / A punto de llorar / Romper a llorar
  • Bare: Vacío
  • Beat: Latir
  • Bland: Soso
  • Boom: En auge
  • Cattle: Ganado
  • Council: Ayuntamiento
  • Cheer: Aplaudir / Vitorear
  • Cope: Afrontar
  • Costume: Vestuario
  • Crop: Cultivo / Cosecha
  • Deserted: Vacío
  • Deserve: Merecer
  • Filling: Saciante
  • Fool: Engañar, tomar el pelo
  • Grate: Rallar
  • Halfway (through/up/down): A la mitad de
  • Harvest: Cultivar
  • Head (for/towards): Dirigirse a/hacia
  • Host: Anfitrión
  • Inherit: Heredar
  • Juicy: Jugoso
  • Lighting: Iluminación
  • Moving: Conmovedor
  • Outstanding: Excepcional
  • Out of place: Fuera de lugar
  • Overdressed: Demasiado elegante
  • Overrated: Sobrevalorado
  • Posh: Elegante / De moda
  • Raise: Criar animales
  • Regret
... Continue reading "English Language Essentials for Spanish Speakers" »

Client-Side Web Application Development Examples

Classified in Computers

Written on in English with a size of 8.49 KB

Client-Side Web Application Logic

Course Registration Script

This script handles the client-side logic for a course registration form. It fetches available courses, populates a selection dropdown, and processes form submissions to register new entries via an API.

DOM Element Selection and Initialization

The script begins by selecting necessary DOM elements for interaction and notification display.

const init = async function () {
  const selectEl = document.querySelector("select");
  const formEl = document.querySelector("form");
  const notifEl = document.querySelector(".success-notif");
  const errNotifEl = document.querySelector(".fail-notif");

Notification Dismissal Logic

Functionality to close success and error notification boxes is implemented

... Continue reading "Client-Side Web Application Development Examples" »

C++ Code Examples: Essential Algorithms & Programs

Classified in Computers

Written on in English with a size of 5.54 KB

C++ Code Examples: Essential Algorithms & Programs

Here are some fundamental C++ code examples covering various algorithms and programming concepts:

Factorial Calculation

#include <iostream>
using namespace std;

long factorial(int x) {
 int i, f = 1;
 for (i = 1; i <= x; i++) {
 f = f * i;
 }
 return f;
}

int main() {
 int n;
 cout << "Enter the number: ";
 cin >> n;
 if (n < 0) {
 cout << "Factorial is not defined for negative numbers";
 } else {
 cout << "Factorial = " << factorial(n);
 }
 return 0;
}

String Length Finder

#include <iostream>
using namespace std;

int main() {
 int length = 0, i;
 char s[20];
 cout << "Enter the string: ";
 cin.getline(s, 20);
 for (i = 0; s[i] != '\0'
... Continue reading "C++ Code Examples: Essential Algorithms & Programs" »

OSPF Routing Essentials: Configuration & Troubleshooting

Classified in Language

Written on in English with a size of 3.62 KB

OSPF DR/BDR HQ Router Connection

Refer to the exhibit. Which statement describes the DR/BDR HQ router connection?

HQ is a DROTHER.

Frame Relay OSPF Point-to-Multipoint Characteristics

What two characteristics are associated with Frame Relay OSPF point-to-multipoint environments? (Choose two.)

  • A DR is not elected.
  • OSPF neighbor routers are statically defined.

OSPF Default Gateway Determination for R2

Refer to the exhibit. How was the default gateway entry for R2 determined in OSPF?

The default gateway entry for R2 was determined because the default-information originate command is applied on R1.

OSPF Requirement for Sharing Routing Information

What is always required for OSPF routers to share routing information?

For OSPF routers to share routing information,... Continue reading "OSPF Routing Essentials: Configuration & Troubleshooting" »

Slovakia: Economy, Transport, and Cultural Highlights

Posted by Anonymous and classified in Geography

Written on in English with a size of 6.74 KB

Slovakia's Transport Infrastructure

Types of Transport

  • Road Transport: The most common mode.
  • Railway Transport: Essential for goods and raw materials.
  • Water Transport: Primarily via the Danube River.
  • Air Transport: Supports tourism and business.
  • Pipeline Transport: Crucial for energy infrastructure.

Road Network

Major Highways (D-series)

  • D1: Bratislava – Košice
  • D2: Connecting Hungary and the Czech Republic
  • D3
  • D4

Expressways

Slovakia also features a network of expressways complementing its highway system.

Economic Importance of Road Transport

  • Significantly supports the automotive industry.

Railway Transport

Role in the Economy

  • Primarily used for the transport of goods and raw materials such as coal and sand.

Types of Railway Companies

  • ZSSK: Public passenger transport
... Continue reading "Slovakia: Economy, Transport, and Cultural Highlights" »