From a5d762d997578e21e63689b217775be08cd6565f Mon Sep 17 00:00:00 2001 From: Ibrahim Klusmann <39280134+ibhf13@users.noreply.github.com> Date: Fri, 28 Nov 2025 19:05:45 +0100 Subject: [PATCH 1/3] Add introduction to GitHub and VSCode usage Added introductory content on using GitHub and VSCode. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..74c4075 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +This is an Introduction on How to use Github, VSCode and install some usefull extenstion depending on the Track + +Check the Files to install the installations and learn the git commands + + + + + +WD First Assignment +https://github.com/TechLabs-Dusseldorf/Assignments1 From 0b2916c328c8bea941f78c5f36eca0897474c207 Mon Sep 17 00:00:00 2001 From: giteeneyazi555-pixel Date: Sat, 29 Nov 2025 19:30:28 +0430 Subject: [PATCH 2/3] signing readme Geeti --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 74c4075..3415e9a 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,7 @@ Check the Files to install the installations and learn the git commands WD First Assignment https://github.com/TechLabs-Dusseldorf/Assignments1 + + +signed by Geeti + From 90afb219e76d68bfe5af73b06814cf1b5f791a52 Mon Sep 17 00:00:00 2001 From: giteeneyazi555-pixel Date: Mon, 8 Dec 2025 08:28:40 +0430 Subject: [PATCH 3/3] feat: implement text analyzer function --- analyzeText.js | 37 +++++++++++++++++++++++++++++++++++++ index.js | 5 +++++ 2 files changed, 42 insertions(+) create mode 100644 analyzeText.js create mode 100644 index.js diff --git a/analyzeText.js b/analyzeText.js new file mode 100644 index 0000000..db5fa4d --- /dev/null +++ b/analyzeText.js @@ -0,0 +1,37 @@ +function analyzeText(paragraph, topN = 5) { + if (!paragraph || typeof paragraph !== 'string') return { totalWords: 0, uniqueWords: 0, averageWordLength: 0, topWords: [] }; + + // 1. Normalize text and remove punctuation + const cleaned = paragraph.toLowerCase().replace(/[^\w\s]/g, ' '); + + // 2. Split into words + const words = cleaned.trim().split(/\s+/).filter(Boolean); + + const totalWords = words.length; + let totalLength = 0; + const freq = {}; + + // 3. Count words & total length + for (const w of words) { + totalLength += w.length; + freq[w] = (freq[w] || 0) + 1; + } + + const uniqueWords = Object.keys(freq).length; + const averageWordLength = totalWords ? Number((totalLength / totalWords).toFixed(2)) : 0; + + // 4. Get top N words + const topWords = Object.entries(freq) + .sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])) + .slice(0, topN) + .map(([word, count]) => ({ word, count })); + + return { + totalWords, + uniqueWords, + averageWordLength, + topWords + }; +} + +module.exports = analyzeText; diff --git a/index.js b/index.js new file mode 100644 index 0000000..87d1e58 --- /dev/null +++ b/index.js @@ -0,0 +1,5 @@ +const analyzeText = require('./analyzeText'); + +const paragraph = `The demand for individuals with tech skills is increasing. The good news is that you do not have to study IT to learn coding! We help you enter the Tech World – independent of your prior knowledge. Our Digital Shaper Program combines online learning, project work and community events to make learning as fun and easy as possible. As we believe that education should be free for everyone we are pleased to educate Techies in our four courses: Web Development, Data Science, Artificial Intelligence and UX-Design. We believe that these tracks are perfect to get started and enter the tech world. Sign up for our program beginning of each semester.`; + +console.log(analyzeText(paragraph));