@WorldNews · Post #73670 · 28.03.2026 г., 09:24
Indonesia bans social media for under 16, 1st in Asia [Read FullArticle] @WorldNews#Indonesia#SocialMediaBan#DigitalPolicy
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #121 · 20 јул.
Регулярно требуется преобразовать какой-либо текст в максимально совместимый текст для URL, имени файла, имени объекта в каком-то софте и тд. Требования совместимости простые: в тексте должны быть только допустимые символы. Обычно это a-z, 0-9 и "_" или "-". То есть, только прописные буквы латинского алфавита и цифры (как пример). Допустим, нам нужно название статьи в блоге преобразовать в slug для добавления его в URL этой статьи. Как это лучше всего сделать? В Django по умолчанию есть готовая функция slugify для таких случаев. Но я её никогда не использую. Почему? Потому что её недостаточно! Приведём пример >>> from django.utils.text import slugify >>> slugify('This is a Title') 'this-is-a-title' Пока всё отлично >>> slugify('This is a "Title!"') 'this-is-a-title' Спец символы удалились, всё хорошо. >>> slugify('Это заголовок статьи') '' Вот и приехали 😢. Если текст не английский то буквы просто игнорируются. Можно это поправить >>> slugify('Это заголовок статьи', allow_unicode=True) 'это-заголовок-статьи' Но тогда мы не вписываемся в условие. У нас появилась кириллица в тексте. Так как я часто пишу сайты для русскоязычных пользователей эта проблема весьма актуальна. Я не использую стандартную функцию и всегда пишу свою. Оригинал я не беру в расчёт и пишу полностью свою функцию. И так, по порядку: 🔸1. Исходный текст: >>> text = 'Мой заголовок №10 😁!' Взял специально посложней со специальными символами. 🔸2. Транслит Необходимо сделать транслит всех символов в латиницу. Здесь очень выручает библиотека unidecode. Помимо простого транслита кириллицы в латиницу она умеет преобразовывать спец символы и иероглифы в текстовые аналоги. from unidecode import unidecode >>> unidecode("Ñ Σ ® µ ¶ ¼ 月 山") 'N S (r) u P 1/4 Yue Shan' Очень крутая библиотека, советую👍 В нашем случае получаем такое преобразование: >>> text = unidecode(text) >>> print(text) 'Moi zagolovok No. 10 !' Отличный транслит. Смайл просто удалился, хотя я ждал что-то вроде :). Ну и ладно, всë равно невалидные символы. А еще наш код уже поддерживает любой язык, будь то хинди или корейский. 🔸4. Фильтр символов Unidecode не занимается фильтрацией по недопустимым символам. Это мы делаем в следующем шаге через regex. Просто заменим все символы на "_" если они вне указанного диапазона. >>> text = re.sub(r'[^a-zA-Z0-9]+', '_', text) >>> print(text) 'Moi_zagolovok_No_10_' Символ "+" в паттерне выручает когда несколько недопустимых символов идут рядом. Все они заменяются на один символ "_". 🔸5. Slugify Осталось удалить лишние символы по краям и сделать нижний регистр >>> text = text.strip('_').lower() >>> print(text) 'moi_zagolovok_no_10' Получаем отличный slug! 😎 🌎 Полный код в виде функции. ______________ PS. Проверку что в строке остался хоть один допустимый символ я бы вынес в отдельную функцию. #libs#tricks#django
Пребарај: #digitalpolicy
@WorldNews · Post #73670 · 28.03.2026 г., 09:24
Indonesia bans social media for under 16, 1st in Asia [Read FullArticle] @WorldNews#Indonesia#SocialMediaBan#DigitalPolicy
@ai_and_law · Post #802 · 08.04.2026 г., 07:04
🇪🇺EU AI Act FAQ Updated with Guidance on Agentic AI The European Commission’s AI Act Service Desk added a new section on agentic AI to its FAQ guide under the AI Pact. The update introduces key definitions related to “AI agents” and “agentic AI” and outlines how such systems are addressed within the AI Act framework. The guidance highlights that existing AI Act provisions apply to agentic AI, with particular emphasis on Article 5(1) prohibitions concerning harmful manipulation and exploitation of vulnerabilities, identifying these rules as especially relevant for this category of systems. #AIRegulation#EUAIAct#AgenticAI#AIgovernance#DigitalPolicy
@ai_and_law · Post #636 · 15.08.2025 г., 07:04
🇩🇪Germany’s Digital Minister Calls for a Leaner, More Innovation-Friendly AI Act Germany’s Federal Minister for Digital Transformation and Government Modernisation, Karsten Wildberger, has voiced sharp concerns over the EU AI Act, describing it as “overloaded and too complex.” Speaking to Euractiv, he argued that while addressing risks is essential, the current regulatory framework imposes excessive bureaucracy that could hinder innovation. Wildberger backed the European Commission’s plan to create AI training hubs, or “gigafactories,” as a step toward strengthening Europe’s technological capacity. His position underscores a tension within EU policymaking—balancing robust safeguards with an enabling environment for AI development. #AIRegulation#EUAIAct#Germany#DigitalPolicy
@ai_and_law · Post #806 · 14.04.2026 г., 07:04
📖How Metaphors Shape AI Regulation A research paper by the Centre for Digital Ethics (CEDE), “The Artificial in ‘Artificial Intelligence’: How Imagination Shapes AI Regulation,” examines how metaphorical language influences legal and regulatory approaches to AI. Drawing on cognitive linguistics, the paper argues that concepts such as “intelligence,” “black box,” and “hallucination” are not neutral descriptors but frameworks that shape how risks, responsibility, and authority are understood. The authors highlight that legal interpretation relies on language with normative force, meaning these metaphors can steer regulatory outcomes and create path dependence. For example, “intelligence” encourages anthropomorphism, “black box” narrows focus to the model rather than the broader system, and “hallucinations” mischaracterize predictable errors as anomalies. The paper proposes reframing such errors as design-related risks arising from system features and interaction dynamics. #AIRegulation#AIethics#LegalTheory#AIGovernance#DigitalPolicy
@ai_and_law · Post #796 · 31.03.2026 г., 07:04
🇪🇺EU Rights Bodies Warn on AI Act Amendments in Digital Omnibus Equinet and ENNHRI issued a joint statement raising concerns over proposed amendments to the AI Act within the Digital Omnibus package. The organizations state that changes are being advanced without sufficient impact assessments or public consultation, potentially affecting fundamental rights protections. They also highlight that the AI Act only entered into force on 1 August 2024, with most obligations applying from 2 August 2026, making meaningful assessment of its effects premature. The statement stresses the European Commission’s obligations under EU Treaties and Better Regulation Guidelines to ensure transparent consultation and evidence-based policymaking. It also warns that simplifying regulation based on company size rather than AI system risk could have systemic consequences, given the dominance of SMEs and Small Mid-Caps in the EU economy. Equinet and ENNHRI recommend preserving core safeguards, including AI system registration, powers of fundamental rights authorities, high-risk system timelines, strict necessity standards, AI literacy obligations, and key information requirements. They also oppose weakening GDPR definitions of personal data and proposed changes to automated decision-making rules. #AIRegulation#EUAIAct#FundamentalRights#DigitalPolicy#GDPR