Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в Python в модуле re.
Чтобы указать флаг для компилятора нам надо указать его после передаваемой строки. Например, добавляем флаг для игнорирования переноса строки.
pattern = re.compile(r"(\w+)+")
words = pattern.search(text, re.DOTALL)
А как указать несколько флагов? Ведь явно будут ситуации когда нам потребуется больше одного. Кто читал посты по битовые операторы уже понял как.
pattern.search(text, re.DOTALL | re.VERBOSE)
А теперь смотрим исходники, что находится в этих атрибутах?
Не удивительно, степени двойки. Почему? Потому что каждое следующее значение это сдвиг единицы влево.
>>> for n in [1, 2, 4, 8, 16, 32, 64, 128, 256]:
>>>
print(bin(n))
0b1
0b10
0b100
0b1000
0b10000
0b100000
0b1000000
0b10000000
0b100000000
Чтобы было понятней, давайте напишем тоже самое но иначе, добавим ведущие нули:
000000001
000000010
000000100
000001000
000010000
000100000
001000000
010000000
100000000
Не понятно что тут происходит? Читай три поста про битовые операторы начиная с этого ➡️https://t.me/pythonotes/45
В общем, это пример применения побитовых операций в самом Python.
Теперь вы знаете Python еще немного лучше)
#tricks#regex#libs
green flag: IRAS bot will never get annoyed at you for asking the same questions every tax season 😅 Got a tax question? Use the IRAS bot to get help any time you need. 😉
https://www.iras.gov.sg/digital-services/others/iras-bot
#chatbot#irassg
Air Canada Ordered to Honor Chatbot's Impromptu Refund Policy
Hello everybody! In a landmark decision, Air Canada has been directed by Canada's Civil Resolution Tribunal to uphold a refund policy cited by its customer service chatbot. The ruling sets a potential precedent for similar cases involving automated customer service platforms.
The saga began when Jake Moffatt sought bereavement fares following his grandmother's passing in November 2022. Engaging with Air Canada's chatbot, he was informed of a retroactive refund option for reduced bereavement rates. Despite Air Canada's insistence that the chatbot's actions were independent, the tribunal ruled in Moffatt's favor, deeming the airline accountable for the chatbot's representations.
This decision not only obligates Air Canada to refund Moffatt's fare but also underscores the significance of accuracy and accountability in automated customer interactions. As chatbots become increasingly prevalent in customer service, the ruling highlights the need for companies to ensure consistency and reliability in their AI-driven communications.
#AirCanada#Chatbot
🧠 Google Gemini endi eski suhbatlaringizni eslab qoladi! 💾
Endi Gemini istalgan suhbatni eslab qoladi va kerak bo‘lsa, eski suhbatlaringizga o‘zi murojaat qiladi!😱
🔹RAG tizimi ishlaydi – oldingi chatlaringizdan ma’lumotni topish va ulardan foydalanish imkoniyati!
🔹Mavzuga mos bo‘lsa, AI o‘zi eslab qoladi va sizga kerakli faktlarni taqdim etadi.
🔹Siz istalgan suhbatga murojaat qilishingiz mumkin, hatto u uzoq vaqt oldin bo‘lsa ham!
📌Bitta muhim narsa:
🛑Cheksiz xotirani faollashtirish uchunGemini Advanced obunasi kerak.
🛑Hozircha faqat Flash modeli bilan ishlaydi.
🔮OpenAI ham shunday funksiyani ishlab chiqayotganini aytgandi… Ko‘ramiz, kim birinchi bo‘ladi!🚀
#Gemini#AI#Google#Chatbot
Shhh! Close the curtain quickly!
We don't want the neighbors to see anything! 🤫👀💥
Chat and see more selfies:
📲(iOS)
📲(Android)
#stepsis#aigirlfriend#chatbot
All of your image creations, all in one place.
Introducing the new library for your ChatGPT image creations—rolling out now to all Free, Plus, and Pro users.
➖➖➖➖🔻
💎@Chatgpt_OfficialNews – Stay Updated! ⚡️
🧠 BOT: @Chatgpt_OfficialBOT
#️⃣#OpenAI#AI#GPT#ChatGPT#Chatbot
➖➖➖➖🔺