Skip to main content

How to Start Ethical Hacking

In today’s digital age, hacking isn’t just about breaking into systems and stealing data. It’s a multifaceted field with a growing emphasis on ethical practices and legal frameworks. Ethical hacking, also known as penetration testing or white-hat hacking, plays a crucial role in cybersecurity by helping organizations identify and fix vulnerabilities before malicious hackers can exploit them. If you’re interested in getting into hacking but want to stay on the right side of the law, this guide will walk you through the steps to start hacking legally and ethically. Understand What Ethical Hacking Is Ethical hacking involves testing systems, networks, and applications for vulnerabilities with the permission of...

পাইথন দিয়ে Language Translator ছোট প্রজেক্ট তৈরি করুন 2024

 হ্যালো ফ্রেন্ডস আজকে আপনাদের নতুন একটা জিনিস সেখানে চেষ্টা করব সেটা হচ্ছে পাইথন দিয়ে আপনারা নিজেই একটা ভাষা ট্রান্সলেটর ছোট্ট একটা প্রজেক্ট তৈরি করতে পারেন । তো চলুন শুরু করা যাক আজকের পোস্ট। প্রথমেই বলে রাখি এটা খুবই জটিল জিনিস না যাদের পাইথন সম্পর্কে কিছুটা ধারণা আছে তারা ভালো পারবে এবং যারা পাইথন নতুন শিখছেন তাদেরকেও আমি বোঝানোর চেষ্টা করব সম্পূর্ণ ভাবে চিন্তা করবেন না। এটা কয়েক লাইনের কোড। তো আপনাদের ফাংশন সম্পর্কে ধারণা রাখতে হবে ভ্যারিবল সম্পর্কে ধারণা থাকতে হবে এবং প্যারামিটার কি সে সম্পর্কে ধারণা থাকতে হবে তাহলে আপনি ছোট্ট কয়েকটা লাইনের কোড দিয়ে আপনি ট্রান্সলেটর তৈরি করতে পারবেন।

আমি পাইথন কোড রান করাবো মোবাইলে । আপনার কম্পিউটারে আশা করা যাক সবকিছু সেটআপ করা আছে পাইথন।

আমি মোবাইলে pydroid 3 অ্যাপ্লিকেশনটি ব্যবহার করছি আপনি চাইলে মোবাইলে pydroid 3 এপ্লিকেশনটি ব্যবহার করতে পারেন । Playstore এ গিয়ে সার্চ করবেন pydroid , তাহলে পেয়ে যাবেন।

তো আমরা এটা গুগলেরই একটা মডিউল ব্যবহার করব এই মডিউল টা দিয়ে আমরা খুব সুন্দরভাবে একটা ভাষা ট্রান্সলেটর প্রজেক্ট তৈরি করতে পারি।

প্রথমে আপনার pydroid অ্যাপ্লিকেশনের টার্মিনালে চলে যাবেন টারমিনালে গিয়ে জাস্ট লিখবেন

 pip install googletrans==4.0.0-rc1

pip এর full form (“পছন্দের ইনস্টলেশন প্রোগ্রাম”) “Preferred Installer Program”



উপরের কমান্ডো যখন লিখবেন তখন googletrans নামের একটা মডিউল ইন্সটল হয়ে যাবে। এখন চাইলে আপনি মডিউলটা ব্যবহার করতে পারেন আপনার প্রোগ্রামে।

চলুন প্রোগ্রাম লেখা যাক।

প্রথমে আমরা তো মডিউল টা ইন্সটল করলাম এখন তো আমাদের প্রোগ্রামে মডিউল ব্যবহার করতে হবে তো ব্যবহার করতে হলে আমাদের মডিউলটাকে ইমপোর্ট করতে হবে। আমাদের প্রোগ্রামে এখন কিভাবে ইমপোর্ট করব? প্রোগ্রামে জাস্ট লিখুন :

 from googletrans import Translator


উপরের লাইনটা লিখে আমরা বলতে চাইছি যে গুগল ট্রান্স নামের একটা পাইথন ফোল্ডার আছে ওই পাইথন ফোল্ডার থেকে আমরা ট্রান্সলেটর নামের একটা class বা ফাইল আছে ওই class কে আমাদের প্রোগ্রামে ইমপোর্ট করে নিলাম।

এখন পরবর্তী লাইনে,
প্রথমে আমরা text নামের একটা ভ্যারিয়েবল তৈরি করব এবং এই ভ্যারিয়েবল এ আমাদের টেক্সট থাকবে যেই টেক্সটে আমরা ট্রান্সলেট করবো:

 text = "কেমন আছেন?" 

এবার আমরা যে ল্যাঙ্গুয়েজে text ট্রান্সলেশন করতে চাই সেই ল্যাঙ্গুয়েজটা একটা ভ্যারিয়েলে স্টোর করে রাখবো এখানে lang নামের ভ্যারিয়েবল ডিক্লেয়ার করলাম এবং এই lang ভ্যারিয়েবলের ভেতরে ল্যাঙ্গুয়েজ এর শর্ট নেম টা দিয়ে দিলাম:

 lang = "en" 

আপনি যেই ল্যাঙ্গুয়েজে ভাষাকে ট্রান্সলেট করতে চান সেই ল্যাঙ্গুয়েজ টার অবশ্যই শর্ট নেম দিতে হবে যেমন ইংরেজির en , বাংলার bn এবং হিন্দির hi এগুলো গুগল সার্চ করে আপনি দেখে নিতে পারেন।

একটা জিনিস খেয়াল করে দেখবেন যে পাইথনে যেকোন টেক্সট যদি আমরা লিখতে চাই অবশ্যয় আমাদের ডবল কোটেশনের “” ভিতরে লিখতে হবে যেমন উপরে আমরা দেখলাম যে “সবাই কেমন আছেন” , “en” এগুলো সবই কিন্তু ডবল কোয়াটেশনের ভিতর আমরা লিখছি কারণ এগুলো সব টেক্সট । পাইথনের টেক্সট লিখতে হলে অবশ্যই ডবল কোটেশনের ভিতরে লিখতে হবে। (আপনি চাইলে ডবল কোটেশন ” ” অথবা সিঙ্গেল ‘ ‘ কোটেশন ব্যবহার করতে পারেন কোন সমস্যা নেই এতে)


তো এখন এই উপরে প্রথম লাইনে ইমপোর্ট করা Translator ক্লাসটাকে আমরা একটা ভ্যারিয়েবল এর ভিতরে রেখে দিতে পারি নিচের মতো:

 translator = Translator() 

এখন আমরা Translator() ক্লাসের ভিতরে একটি ফাংশন আছে translate নামে। এই ফাংশন কে ইউজ করে আমরা ভাষা ট্রান্সলেট করবো।

 translation = translator. translate() 

উপরের কোডে আমরা translation নামের একটা ভ্যারিবল ডিক্লেয়ার করেছি এবং এই ভ্যারিবল থেকে আমরা translator ক্লাস থেকে translate() ফাংশন কে ব্যবহার করছি।

এখন translate() ফাংশনটি আবার দুইটা প্যারামিটার নেয়।
প্রথম প্যারামিটার টা হচ্ছে “text” এবং দ্বিতীয় প্যারামিটারটা হচ্ছে আমরা যে ল্যাঙ্গুয়েজে text কে ট্রান্সলেটর করতে চাচ্ছি সেই ল্যাঙ্গুয়েজটা দিতে হবে।

এখন উপরের কোডটা আমরা এভাবে লিখবো:

 translation = translator.translate(text, dest=lang)

এখন প্রোগ্রাম রান করান। দেখবেন কাজ হবে।

আপনারা চাইলে এখানে text ভ্যারিয়েবল এ intput() ফাংশন ব্যবহার করতে পারেন এবং ইউজারের কাছ থেকে যে কোন টেক্সট নেবেন এবং lang ভেরিয়েবলে input() ফাংশন ব্যবহার করতে পারেন এবং ইউজারের কাছ থেকে যে ভাষায় ট্রান্সলেট করবেন সেই ভাষার ল্যাঙ্গুয়েজটা নিবেন এভাবে প্রোগ্রাম রান করতে পারেন।

সম্পূর্ণ কোডটা নিচে দেওয়া হল

from googletrans import Translator

text = "কেমন আছেন?"

lang = "en"

translator = Translator()

translation = translator.translate(text, dest=lang)

print(translation.text)


Comments

Popular posts from this blog

How to Start Ethical Hacking

In today’s digital age, hacking isn’t just about breaking into systems and stealing data. It’s a multifaceted field with a growing emphasis on ethical practices and legal frameworks. Ethical hacking, also known as penetration testing or white-hat hacking, plays a crucial role in cybersecurity by helping organizations identify and fix vulnerabilities before malicious hackers can exploit them. If you’re interested in getting into hacking but want to stay on the right side of the law, this guide will walk you through the steps to start hacking legally and ethically. Understand What Ethical Hacking Is Ethical hacking involves testing systems, networks, and applications for vulnerabilities with the permission of...

How Do Space Stations Communicate with Earth?

Space stations , like the International Space Station (ISS), orbit hundreds of kilometers above our planet, creating a challenging environment for communication. Yet, staying in touch with Earth is essential for the safety of astronauts and the success of missions. In this blog post, we'll explore the fascinating world of space station communication and how these high-tech outposts stay connected with our home planet. 1. Ground Stations:    - At the heart of space station communication are ground stations strategically located around the world. These stations are equipped with large, sensitive antennas that can transmit and receive signals to and from space. They are often spread out to ensure continuous coverage as the space station orbits the Earth. 2. Tracking and Data Relay Satellites (TDRS):    - To maintain almost constant communication with space stations, especially those in low Earth orbit (LEO), NASA employs a network of Tracking and Data Relay Satellites (...

How Space Stations Work A Fascinating Journey into Outer Space

Space stations are incredible feats of engineering that orbit our planet, serving as research laboratories, living quarters, and observation platforms in the vast expanse of space. These complex structures are not only marvels of technology but also crucial for advancing our understanding of space and our capabilities in it. In this blog post, we will take a closer look at how space stations work and the essential components that keep them operational. Orbit and Location: Space stations, such as the International Space Station (ISS), are typically placed in low Earth orbit (LEO), which is approximately 400 kilometers (about 250 miles) above Earth's surface. This orbit allows them to travel around the Earth approximately every 90 minutes, experiencing multiple sunrises and sunsets each day. The proximity to Earth makes it feasible for resupply missions, crew rotations, and communication with mission control centers. Structure and Design: Space stations are comprised of various inte...