Saturday, June 12, 2021

Corruption (Ann Mumo, 20210613)



Corruption 1) Governance: For our governments to be stable and effective, we must fight corruption. 2) Strong Judicial System: We should ensure that leaders and government agents became answerable to the taxpayer. 3) Education: The public should be educated on the ills of corruption. 4) Right to Information (RTI) Against The Corrupt Citizens: While those who have stolen public funds are made to return it and face the full force of the law. 5) Right to Information (RTI) Against The Tax Havens: Again, people known to have stashed money in foreign banks should be forced to repatriate that money so as to improve cash flow in our economies. This will put our countries on the road to prosperity. 6) Digitization of The Economy: Through digitization of the economy, we can bring in transparency, and corruption would reduce. Tags: Indian Politics,Politics,Banking,Investment,Kenya,Management,Technology,

Friday, June 11, 2021

Doctors and Human Rights Violation (Ann Mumo)



The medical profession has a long tradition of respect for human rights. However a small number of doctors and health professional have betrayed ethical norms and insisted in abuses against detainees and prisoners. AL medical groups in many countries around the world campaign for an end of medical participation in human rights violations. In countries where human rights violations are widely spread, medical personnel can have access to prisoners in circumstances where the prisoner is denied other protective contact such as with legal counsel or with family. For these reasons, doctor's role "I'm safeguarding the health and security of the prisoner" is of considerable importance. Where human rights violations are not systematic or not even a major concern, the doctors can still play a protective role. But in many countries this role of protection is negated by the failure of medical personnel to adhere to basic tenets of medical ethics. It is not possible to determine the number of individual abuses involving doctors nor the number of doctors involved in human rights violations around the world. The definition of what constitutes medical involvements is not clear. The number of doctors consciously and deliberately engaging in torture and other cruel inhuman and degrading treatment or punishment represent a tiny proportion of profession. The number of those who are aware of abuses carried out against prisoners by police, security or prisoners officer is much more substantial. Medical involvement in torture ranges from the inflection of torture by the doctors themselves, through acting as an adviser or medical supervisors of torture to the false certification of health or of death after torture has been afflicted. In many case's, the behaviors of the doctors encompasses more than one of these roles. The role of doctors in torture stem from his medical expertise. The doctors appear to play the role of advisory during torture rather than inflicting torture personally. However, there is a fine line between inflicting torture and assisting others to carry it out, and doctors who are present during torture can easily slip from one role to the other. In some cases, a medical activity such as administering medication by intravenous injection may appear to the prisoner to be threatening or even a form of torture. When doctors administer substances in the absence of therapeutic need and with the intention to cause suffering they become torturous. Moreover, the vulnerability of the prisoners and the sense of betrayed which he or she experiences when confronted by a doctor who is working with torture can itself amplify the suffering. AL have received evidence and numerous testimonies from prisoners. In Morocco, a prisoner alleged in 1986 that a medical person was involved in the torture. Doctors may be present during torture to prevent the death of the prisoner or to ensure that the prisoner leaves no mark. The torture were highly trained in methods of exacting the maximum pain without leaving any significant physical traces. AL has received reports of medical examination being genuine just prior to the appearance in court. It has also documented the use of medical certificates to falsely indicate that the prisoner has been released from custody. In some cases it is not clear whether certificates have been deliberately falsified or are incompetently prepared. Pressure is sometimes applied to medical personnel to withhold or to falsify evidence. The participation of doctors in such punishment has been documented. Powerful antipsychotic drugs have in the past been regularly administered to prisoners. Medical personnel have also failed to protect patients from arbitrary violence inflicted by nurse or guards. There has been a long tradition of medical attendance at executions in Europe. The presence of doctors in the execution chamber could result in their having to participate in the execution process even where the method is not at all.Some doctors have placed the interest of security forces of the prisoners. Over two thousands years after Hippocrates, it is surely that all medical practitioners must observe the dictum "Above all, do no harm". Notes Primum non nocere (Classical Latin: [ˈpriːmũː noːn nɔˈkeːrɛ]) is a Latin phrase that means "first, do no harm". The phrase is sometimes recorded as primum nil nocere. Non-maleficence, which is derived from the maxim, is one of the principal precepts of bioethics that all students in healthcare are taught in school and is a fundamental principle throughout the world. Another way to state it is that, "given an existing problem, it may be better not to do something, or even to do nothing, than to risk causing more harm than good." It reminds healthcare personnel to consider the possible harm that any intervention might do. It is invoked when debating the use of an intervention that carries an obvious risk of harm but a less certain chance of benefit. Non-maleficence is often contrasted with its corollary, beneficence. Tags: Kenya,Indian Politics,Politics,Behavioral Science,Medicine,Psychology,Science,

Quick Setup Tips by GitHub itself



Both together:
Tags: Technology,GitHub,Cloud

Thursday, June 10, 2021

2013 Mar 01 (Grandpa handing me Rs 1000 for the project)



Index of Journals
1-March-2013
• I was calling from aunt’s phone and amma saw it, and commented. I have money issues. Babaji spoke to show off his wealth, kind of my reverse psychology skills came into being. He handed me Rs 1000 straight. He was, of course, unhappy, but I told him that I was going to use them for the entire project and not just for paying phone bill.

• Spitting, person reminding of Anshu (the communication skills teacher), and a man taking a leak in my view.

• 15 minutes walk to get Mukesh here left me tired, knees were feeling it.

1030-1410: I was with Mukesh for final project based on NLP (Natural Language Processing).

1300: Mahima and Esha were outside window. Mahima screaming about her Math exam gone well. They were gone now and 10 minutes later, Naina’s voice (low, going, once).

I made the drawings, Mukesh put them on computer.
• I made calls from his phone so there were calls on his phone on ‘time’, crazy.

INFRARED / SURVEILLANCE EFFECT:
Evening: Apple Ads on TV in sync with my movement in and out of the room. Or it was like every second ad.
Tags: Journal,Psychology,Emotional Intelligence,

Maximum Dosage of Saridon Pill



Saridon: Key ingredients

1. Paracetamol I.P.: 250 mg 2. Propyphenazone I.P.: 150 mg 3. Caffeine I.P. (anhydrous): 50 mg

Acetaminophen safe dosage basics

Ref: health.harvard.edu Acetaminophen controls pain and fever but does not reduce inflammation, as does aspirin and the other widely consumed nonsteroidal anti-inflammatory drugs (NSAIDs) ibuprofen (Advil, Motrin, generics) and naproxen (Aleve, generics). But unlike NSAIDs, acetaminophen does not irritate the stomach and intestinal lining. That means a person who cannot tolerate NSAIDs can still take acetaminophen. It's an important drug for controlling chronic pain in older adults. How to stay within limits If you ever have concerns about how much acetaminophen you can tolerate based on your age, body size, and health status, talk to your doctor or pharmacist. Here are some general precautions for avoiding an accidental overdose of acetaminophen. 1. Cold and flu remedies count. When you reach for an over-the-counter cough, cold, or flu product, take a look at the label. Does it contain acetaminophen? 2. Know the milligrams in your pills. In acetaminophen products available over the counter, each pill may contain 325, 500, or 650 milligrams of the drug. Be extra cautious when taking 500 or 650 milligram pills. 3. Stick to recommended doses. When taking acetaminophen, don't be tempted to add a little extra to the recommended dose. A small-bodied person should stay on the low end of the recommended dose range (3,000 mg). 4. Easy on the alcohol. Drinking alcohol causes the liver to convert more of the acetaminophen you take into toxic byproducts. Men should not have more than two standard drinks per day when taking acetaminophen (one drink per day for women). 5. Know if your medications interact. Ask your doctor or pharmacist if any of your prescription medications could interact badly with acetaminophen. Acetaminophen: How much can you take safely? 325 mg ## 500 mg ## 650 mg extended release Take how many pills at a time?: 1 or 2 ## 1 or 2 ## 1 or 2 Take how often?: Every 4 to 6 hours ## Every 4 to 6 hours ## Every 8 hours Safest maximum daily dose for most adults: 8 pills ## 6 pills ## 4 pills Never take more than this in a 24-hour period: 12 pills (3900 mg) ## 8 pills (4000 mg) ## 6 pills (3900 mg) Saridon has 250mg of Paracetamol: maximum daily dosage to sum upto 4000mg => 16 pills ~ ~ ~

Propyphenazone: Maximum Dosage

Ref: medindia.net In India: Dart (300mg/150mg/50mg) • The recommended dose of the drug is 75 to 150 mg tablet orally. • Propyphenazone should be taken up to a maximum of four times a day. Maximum Dosage: 4 pills ~ ~ ~

Caffeine

Ref: mayoclinic.org How much is too much? Up to 400 milligrams (mg) of caffeine a day appears to be safe for most healthy adults. That's roughly the amount of caffeine in four cups of brewed coffee, 10 cans of cola or two "energy shot" drinks. Keep in mind that the actual caffeine content in beverages varies widely, especially among energy drinks. Caffeine in powder or liquid form can provide toxic levels of caffeine, the U.S. Food and Drug Administration has cautioned. Just one teaspoon of powdered caffeine is equivalent to about 28 cups of coffee. Such high levels of caffeine can cause serious health problems and possibly death. You drink more than 4 cups of coffee a day You may want to cut back if you're drinking more than 4 cups of caffeinated coffee a day (or the equivalent) and you have side effects such as: 1. Headache 2. Insomnia 3. Nervousness 4. Irritability 5. Frequent urination or inability to control urination 6. Fast heartbeat 7. Muscle tremors Maximum Dosage of Saridon based on Caffeine content: (400 / 50) mg: 8 pills

Based on the constituent salts: The maximum dosage of Saridon comes out to be 4 pills (based on maximum dosage of Propyphenazone)

References

1. SC exempts painkiller Saridon from the banned list in India, September 2018 2. Tension headache - Wikipedia 3. International Classification of Headache Disorders 4. survival8 Tags: Medicine,Science,

Wednesday, June 9, 2021

Audience Around The World (Jun 2021)



Now [Last 2 Hours]
Day
Week
Month
3 Months
6 Months
12 Months
All Time
Note: We started promotion in Kenya since 25th April 2021. Tags: Data Visualization,Investment,Management,

Sunday, June 6, 2021

2013 Mar 18 (good guy, bad guy tactic and the serious delusion of ads and infrared connection)



Index of Journals
18-Mar-2013
• Driver doped – acting crazy like me – so they put up people that act like me in behavior – yeah in library too
• Driver is also one with the surveillance team. He was acting crazy like myself. So surveillance team has put up people that act like me in behavior. Yeah, and in the college library too I felt similarly about few people.

• Cars were still there
• Cars that I see often were still in there same position. Such as one outside my longer studytable window [like WagonR for weeks at a time, or then Zen for weeks at a time], or the one next to the main gate [like Aqua Blue Toyota Corola belonging to Sagar Balal (this one was for months)] and visible from the door to the balcony in grandma's room. Or like the i10 parked right outside our balcony everyday beloging to the lawyer Geeta (friend of Hardik's parents)

What you are going to read next are my conversations with three buas that would appear very familiar to you what expert negotiators call "Good guy, bad guy" tactic:
• Last night – R-buaji said for me to find a job – that bbg cannot pay further
• Last night, Rekha bua said for me to find a job and that grandpa cannot pay further for my college fees.

• I told M-buaji abt it in the morning in car – 1330, b-buaji called and told me study paying no attention to nothing without even thinking
• I told Manju aunt abt it in the morning while we were traveling in the car. At 1330, Kumkum bua called and told me study paying no attention to anything, and also not think about it.
• I found her right. 

To the college I wore shirt and belt – the s**t and spit was on always.
To the college I wore shirt and belt (cannot say today [20210607] whether it was with denim pants or formals). The demotivating and demoralizing behavior of people around me was on always.

Shukla tried made s**t up for his phn loss or whatever – since these guys are doped, I cannot be writing what I hear, I should not write about the s**t that is thrown at me – I should only write about what I see
• Yes, so the bulls**t is coming in verbally – f*** them

Abhishek Shukla tried to lie to me for his phone loss or whatever. Since these guys are with surveillance team, I cannot be writing what I hear, I should not write about the verbal-nonsense that is thrown at me. I should only write about what I see.
• Yes, so the nonsense is now coming in verbally. Screw them.

• So Anshu was agn in the same green suit as last two times – that I saw her, yes, 27-feb, 7-mar, 18-mar – light aqua green
• So Anshu ma'am (the Communication Skills teacher) was again in the same green suit (suit as in Indian women wear kurta) as the last two times when I had seen her, yes, 27th of Feb, 7th of Mar, and today is 18th of Mar. The color is light aqua green.

• Two times – they sent bus for Mukesh
• Two times, they had sent bus for Mukesh.
    
• Teachers roamed around – seemed positive for talk, but I couldn’t think of anything
• Teachers roamed around, who seemed positive to talk to, but I couldn’t think of anything.

• Strict following always on – in the cyber café there came three people very close and there should be more around
B4 meeting Shweta – I had get content for talk – I didn’t want to meet her again – so I got the date of 15-Apr of project submission from Uttam sir, then to her I was going to tell this along with ‘which do you read for rules’ 
• She pulled up the talk
• Anshu interrupted to tell a website – I was smiling for this, as I couldn’t have turned my face back and Shweta had looked at her behind me to show listening

• Strict surveillance is always on, even in the cyber café outside of college campus. There came three people very close and there should be more people around.
Before meeting Shweta ma'am, I had to get content for the talk. I didn’t want to meet her again so I got the date of 15th Apr of project submission from Uttam sir, then to her I was going to tell this along with ‘which book do you read for rules’.
• She began to talk and then Anshu interrupted to tell a website (didn't care to note it). I was smiling for this, as I couldn’t have turned my face back and Shweta had looked at her behind me to show that Shweta was listening to her.

~ ~ ~

A guy comes in – in colors, Shweta too – asks for Yamini-ma’am phn no – shows off his phn 
• Well, while this person asks for contact of a teacher – this teacher was asking for my contact (email id, so she could tell some books) but I told Mukesh to give his as ‘I don’t check my email’ I had said to him
• Also while I was only trying to get a book name (for the sake of the talk) – I actually got a book which she pushed for me to keep until that I come next time, even as I was saying to be returning it today
• I thought of leaving and looked down – she tapped her feet, thinking I was looking at them – then she realized for the bye-time – as this guy went, she spoke for a minute maybe and then I sat erect and took a deep-breath and then there was only ‘thank-you’ from me before I got up to move after taking the book in hand – that must have felt to her – they think are always something, even after reading my entire life, it is almost like they need know more

• I was quite and had made up mind to leave while the condescending went on – there was water on the table (on which I had mistakenly put the book, before putting my hand twice thereafter)
• Mukesh had checked for the teacher from the door – so as I open it there was chair behind so that it banged 
• Mukesh gets the seat by himself this time as I chose to sit on entering – while leaving we just left

~ ~ ~

• Two teachers for me here – the third one should be a psyche if they are still f***ed up in their heads
Entire exam-cell changed – f*** that – all the glass walls down and the dividers
• Otherwise it was divided in three parts – first and third thick – middle one thinner for helping people

• Two teachers for me here in the examination cell. The third one should be a psychologist from surveillance team if they are still screwed up in their heads.
Entire examination cell changed (as in construction), all the glass walls and dividers were not there.
• Otherwise it was divided in three parts. First and third dividers were thick and the middle one was thinner for helping people.

• Apple ad then hair-dye-ad-for-an-oldie-with-long-curly-feathery-hair (similar to Anshu’s)– pushed up on random channel, I-red
Apple iPhone ad and then hair dye ad showing an old woman (mother of girls in late teens) with long curly feathery hair (similar to Anshu’s) and the ad pushed up on random channels. I felt it was infrared effect.

Tags: Behavioral Science,Medicine,Psychology,Journal,Emotional Intelligence,

Chapter 2 - My schooling and my grandparents' YOBs

Index of Journals
Hospital I Was Born In
St. Stephens Hospital, New Delhi 
(St Stephens Hospital, Tis-Hazari, Nawab Ganj, New Delhi, Delhi, India, ststephenshospital.org)
Wednesday, 18 December, 1991, 1100 hours.

Schools and Corresponding Years
XII2008-09 Ahlcon Public School
XI2007-08 Ahlcon Public School
X2006-07 Ahlcon Public School
IX2005-06 Ahlcon Public School
VIII2004-05 Ahlcon Public School
VII2003-04 Ahlcon Public School
VI2002-03 Ahlcon Public School
V2001-02 Ahlcon Public School
IV2000-01 Maharaja Agrasen Public School
III1999-2K Maharaja Agrasen Public School
II1998-99 Maharaja Agrasen Public School
I1997-98 Maharaja Agrasen Public School
Kindergrtn1996-97 Maharaja Agrasen Public School
During Pre-school years: Municipal Corp. Gov. Primary School (*)
Blue Bells Primary School (for very short duration, Anu also went there) College 2009-2013: Indraprastha University (Northern India Engineering College (Later aka Akhilesh Das Gupta Institute of Technology and Management)) 2017-2018: Birla Institute of Techonology and Science, Pilani 2019 Onwards: University of Hard Knocks, College of 'survival8'

YOBs of my grandparents

1. UIDAI - Grandma
2. UIDAI - Grandpa
3. Voter ID - Grandma
4. Voter ID - Grandpa
Tags: Journal,Behavioral Science,Medicine,Emotional Intelligence,Psychology,

The Corona Style (by Joseph Owaga)



1. Surviving in curfew times

• Then at once it went, the president reduced working hours to curb the spread of the dreadful Corona virus.
• The policemen as usual were to ensure the rule is upheld and the safety of the citizens. However, this turned to be a different thing the police know found a means of exploiting the citizens up and down, left, right and center. • The operational hours could not allow the clubs to hold their customers any longer. Many found themselves jobless as the number of clients reduced.

2. THE DOCTOR STYLE

i. Who could ever imagine this... everyone behind a face mask. Everybody resembled a doctor on it’s own. ii. Failure to have the face mask became an offense payable by forced quarantine, after a bond of $5. iii. At first the prices of the face mask threatened many as only the 'few' could manage to buy then however, it became cheap afterwards as it flooded into the market in large numbers. iv. Many people were grefull for the mask for it not only helped to reduce the spread of Covid 19 but also other diseases. v. The worst part now came, most of the mask were not biodegradable and this pilled lots of trash in the environment, both in water and on land.

3. The closure of schools And worship places.

On March 1st of 2020 the president announced of the arrival of the virus into Kenya. And after 2 weeks there was nothing to be done the president called for a closure for the schools to avoid overcrowding and 1m meter social distance that was not possible in such institutions.

INSTITUTING TOTAL LOCKDOWN

• Finally to reduce quick transfer of the virus the counties with highest number of infections had no choice to travel out of their countries. • The flights from outside the country was also terminated as it could possibly leak more viruses from other parts, however, the cargo planes were still allowed to operate.

OTHER WAYS THAT WERE INSTITUTED TO REDUCE THE SPREAD OF THE VIRUS

• Frequent sanitizing of hands • Avoiding handshakes, hugging and kissing friends • Avoiding crowded places • Keep Distance at Events and Gatherings: was seid to be safest to avoid crowded places and gatherings where it may be difficult to stay at least 6 feet away from others who are not from your household. If you are in a crowded space, try to keep 6 feet of space between yourself and others at all times, and as it was suggested by the ministry of health

SOCIAL DISTANCE TIPS THAT WERE SET BY THE MINISTER OF HEALTH

• When going out in public, it is important to stay at least 6 feet away from other people and wear a mask to slow the spread of COVID-19. Consider the following tips for practicing social distancing when you decide to go out. • Know Before You Go: Before going out, know and follow the guidance from local public health authorities where you live. • Prepare for Transportation: Consider social distancing options to travel safely when running errands or commuting to and from work, whether walking, bicycling, wheelchair rolling, or using public transit, rideshares, or taxis. When using public transit, try to keep at least 6 feet from other passengers or transit operators – for example, when you are waiting at a bus station or selecting seats on a bus or train. When using rideshares or taxis, avoid pooled rides where multiple passengers are picked up, and sit in the back seat in larger vehicles so you can remain at least 6 feet away from the driver.
Tags: Kenya,Politics,Behavioral Science,Emotional Intelligence,Psychology,

Scientific Devew in Agriculture (Ann Mumo)



In recent times, there have been marked technological advancements in agriculture. There has been a move towards genetically modified crops, use of chemical fertilizers and intensive use of pesticides. Although this has been hailed by all as the only way to ensure food sustenance in Africa, it has come with it's obvious costs.

To begin with, the use of nitrogenous fertilisers has no doubt led to increased yields in agriculture, raising hopes for farmers whose soils have became exhausted out continued tilling year in, year out. However, intensive use of chemical fertilisers has changed the soil pH. Many farmers lack knowledge on maintaining the correct soil pH. Such a soil loses its productivity. On the same note, there are pollution hazards poses by excess nitrates if washed into rivers.

Secondly, there has been the introduction of new strains of food crops which promise high yields. The produce of the new crop cannot be used as seed in the next season. This means farmers have to dig deeper in their pockets every time of planting.

The extensive use of pesticides has ensured trouble free farming. The common crop pests have been effectively eliminated. This means the farmer can easily estimate the amount of harvest he/she will have at head of the season. This notwithstanding, the level and intensity of this pesticides is often uncontrolled. Sometimes, dangerous level of pesticides residue are left in the produce. This is health hazard. Apart from that, pesticides indiscriminately kills all organisms in the farm, often disturbing the delicate balance of nature.

No one can deny that scientific achievement are here to stay and have improved the quality of life. They, however, should not be adopted if there is any danger to humans and their environment. Agricultural scientist's should tend towards the sustenance of indigenous food crops, enhance organic farming and explore possibilities of biological control of crop pests.

Title: Scientific Devew in Agriculture (Ann Mumo)
Tags: Kenya,Politics,

Strike action is an expensive affair! (Ann Mumo)



My friends, I beg you to listen to me before you go ahead with your plans. Going on strike is expensive. How many of us have paused to think of the consequences? If we on strike tonight, we are bound to damage property. Buildings may be razed down and furnitures broken. What about the injuries we are likely to sustain? Who will pay for the damage? Our parents will have to pay for it all. This is adding to the already heavy burden of paying school fees. Why should we do this to them? Comrades, we have walked together for long, will we accomplish this if we distrust classes? And who will be the ultimate loser anyway? My colleagues let's wake up to this reality. We are here for a reason. Let's explore others options in solving our problems. Title: Strike action is an expensive affair! (Ann Mumo) Tags: Kenya,Politics,Behavioral Science,Emotional Intelligence,Psychology,

Mob justice is not justice at all! (Ann Mumo)



Mob justice is not justice at all! By: Ann Mumo There is no justification for mob Justice I'm a civilized society. More often than not,the victims are suspects of petty crimes such as pickpocketing. Does anyone deserve to die for snatching a purse? Mob Justice amounts to dodging the court process, defeats the rule of natural Justice and perpetuates violence in society. The first assumption of the law is that the suspect is deemed innocent until proven guilty in the court of law. Some people claim that the court process is long and that it often set free otherwise guilty persons for lack of credible evidence. However, Mob justice goes against the rules of natural Justice. The public assumes the roles of the complainants, the prosecutor, the jury and judge. Every person suspected of crimes should be allowed to go through the court process so as to get fair hearing. Mob justice is known to have been claimed innocent victims and should be avoided at all costs. Secondly, killing of crimes suspects derail the efforts by the government to control crimes. When a suspect is killed, he dies with information that could be useful to the police. Although some people say that suspects handed over to police are realised uncharged, it would be unwise to public to take the law in their hands. Suspects should be apprehended so as to help police in their investigationa. This assists in nabbing other criminals linked to the arrested suspect and help in prevention of crime. Thirdly, mob Justice is a display of lawlessness and uncivil behavior in society. Many times, we get treated to the gory details of unsightly scenes on our TV screens. Tags: Kenya,Politics,Behavioral Science,Emotional Intelligence,Psychology,

Saturday, June 5, 2021

Python (3) RegEx in Python [20210606]



We had covered Strings in our previous session, which can be found here:
Python (2) String and related packages [20210523]


In this post, we are covering the Python package "re", which stands for RegEx or Regular Expressions.

First step towards working with "RegEx" is by importing the "re" package. Without importing "re", package Python would not know what you are mean by "re".

(base) C:\Users\Ashish Jain>python
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> re

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 're' is not defined

>>> import re
>>> re

<module 're' from 'E:\\programfiles\\Anaconda3\\lib\\re.py'>
>>>

RegEx Functions At a High Level

The re module offers a set of functions that allows us to search a string for a match:

findall : Returns a list containing all matches
search  : Returns a Match object if there is a match anywhere in the string
split   : Returns a list where the string has been split at each match
sub     : Replaces one or many matches with a string

A Regular Expression composed using following parts: Metacharacters, Special Sequences, and Sets.

Metacharacters: These are the characters with a special meaning Character: Description: Example [] A set of characters "[a-m]" \ Signals a special sequence (can also be used to escape special characters): "\d" . Any character (except newline character): "he..o" ^ Starts with "^hello" $ Ends with: "world$" * Zero or more occurrences: "aix*" + One or more occurrences: "aix+" ? Zero or one occurences: "r.?" {} Exactly the specified number of occurrences "al{2}" | Either or "falls|stays" () Capture and group Special Sequences: It is a \ followed by one of the characters in the list below, and has a special meaning: Character: Description: Example \A Returns a match if the specified characters are at the beginning of the string "\AThe" \b Returns a match where the specified characters are at the beginning or at the end of a word (the "r" in the beginning is making sure that the string is being treated as a "raw string") r"\bain" r"ain\b" \B Returns a match where the specified characters are present, but NOT at the beginning (or at the end) of a word (the "r" in the beginning is making sure that the string is being treated as a "raw string") r"\Bain" r"ain\B" \d Returns a match where the string contains digits (numbers from 0-9) "\d" \D Returns a match where the string DOES NOT contain digits "\D" \s Returns a match where the string contains a white space character "\s" \S Returns a match where the string DOES NOT contain a white space character "\S" \w Returns a match where the string contains any word characters (characters from a to Z, digits from 0-9, and the underscore _ character) "\w" \W Returns a match where the string DOES NOT contain any word characters "\W" \Z Returns a match if the specified characters are at the end of the string Sets: A set is a set of characters inside a pair of square brackets [] with a special meaning: Set: Description [arn] Returns a match where one of the specified characters (a, r, or n) are present [a-n] Returns a match for any lower case character, alphabetically between a and n [^arn] Returns a match for any character EXCEPT a, r, and n [0123] Returns a match where any of the specified digits (0, 1, 2, or 3) are present [0-9] Returns a match for any digit between 0 and 9 [0-5][0-9] Returns a match for any two-digit numbers from 00 and 59 [a-zA-Z] Returns a match for any character alphabetically between a and z, lower case OR upper case [+] In sets, +, *, ., |, (), $,{} has no special meaning, so [+] means: return a match for any + character in the string The findall() Function The findall() function returns a list containing all matches. The list contains the matches in the order they are found. import re txt = "The rain in Spain" x = re.findall("ai", txt) print(x) ['ai', 'ai'] txt = "The rain in Spain detected by Mr Jain." x = re.findall("ai", txt) print(x) ['ai', 'ai', 'ai'] txt = "The rain in Spain detected by Mr Jain." x = re.findall("r.?", txt) print(x) ".?" means zero or one occurence of any character, so we get the characters 'a' and ' '. ['ra', 'r '] txt = "The rain in Spain detected by Mr Jain." x = re.findall("r\w?", txt) print(x) "\w?" means zero or one occurence of any word character, so we get the characters 'ra' and only 'r'. ['ra', 'r'] If no matches are found, an empty list is returned. import re txt = "The rain in Spain" x = re.findall("Portugal", txt) print(x) The search() Function The search() function searches the string for a match, and returns a Match object if there is a match. If there is more than one match, only the first occurrence of the match will be returned. import re txt = "The rain in Spain" x = re.search("\s", txt) print("The first white-space character is located in position:", x.start()) The first white-space character is located in position: 3 - - - txt = "The rain in Spain" x = re.search("\s", txt) print(x) <re.Match object; span=(3, 4), match=' '> If no matches are found, the value None is returned. import re txt = "The rain in Spain" x = re.search("Portugal", txt) print(x) The split() Function The split() function returns a list where the string has been split at each match: import re txt = "The rain in Spain" x = re.split("\s", txt) print(x) ['The', 'rain', 'in', 'Spain'] You can control the number of occurrences by specifying the maxsplit parameter: Split the string only at the first occurrence: import re txt = "The rain in Spain" x = re.split("\s", txt, maxsplit = 1) print(x) x = re.split("\s", txt, maxsplit = 2) print(x) ['The', 'rain in Spain'] ['The', 'rain', 'in Spain'] The sub() Function The sub() function replaces the matches with the text of your choice: import re txt = "The rain in Spain" x = re.sub("\s", "9", txt) print(x) The9rain9in9Spain You can control the number of replacements by specifying the count parameter: Replace the first 2 occurrences: import re txt = "The rain in Spain" x = re.sub("\s", "9", txt, count = 1) print(x) x = re.sub("\s", "9", txt, count = 2) print(x) The9rain in Spain The9rain9in Spain Match Object A Match Object is an object containing information about the search and the result. Note: If there is no match, the value None will be returned, instead of the Match Object. Do a search that will return a Match Object: import re txt = "The rain in Spain" x = re.search("ai", txt) print(x) #this will print an object Print all the methods or attributes on Match object: print(x.__dir__()) ['__repr__', '__getitem__', 'group', 'start', 'end', 'span', 'groups', 'groupdict', 'expand', '__copy__', '__deepcopy__', '__class_getitem__', 'string', 're', 'pos', 'endpos', 'lastindex', 'lastgroup', 'regs', '__doc__', '__hash__', '__str__', '__getattribute__', '__setattr__', '__delattr__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__init__', '__new__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__'] The Match object has properties and methods used to retrieve information about the search, and the result: .span() returns a tuple containing the start-, and end positions of the match. .string returns the string passed into the function .group() returns the part of the string where there was a match txt = "The rain in Spain" x = re.search(r"\bS\w+", txt) print(x) print("span:", x.span()) print("string:", x.string) print("group:", x.group()) print("start:", x.start()) <re.Match object; span=(12, 17), match='Spain'> span: (12, 17) string: The rain in Spain group: Spain start: 12 txt = "Mr Jain enjoyed the rain in Spain." x = re.search(r"\bS\w+", txt) print(x) print("span:", x.span()) print("string:", x.string) print("group:", x.group()) print("start:", x.start()) print("end:", x.end()) <re.Match object; span=(28, 33), match='Spain'> span: (28, 33) string: Mr Jain enjoyed the rain in Spain. group: Spain start: 28 end: 33

The "finditer()" function

>>> import re >>> s = "Mr Jain enjoyed the rain in Spain with Ms Jain." >>> re.finditer('ai', s) <callable_iterator object at 0x000001899B48A9B0> >>> >>> fi = re.finditer('ai', s) >>> for i in fi: ... print(i.span()) ... (4, 6) (21, 23) (30, 32) (43, 45) >>> Tags: Technology,Python,Anaconda,Natural Language Processing,

Friday, June 4, 2021

Sounds am annoyed by these days (June 2021)



Index of Journals
21/05/21, 15:28: <Media omitted> This sound is from the water filter outside my room.

21/05/21, 15:29: Am going to try and express my thoughts as well in this environment.

22/05/21, 16:01: ---

22/05/21, 16:02: Am feeling headache.

22/05/21, 16:03: The feeling that I have in my mind as of now is that I need silence.

22/05/21, 16:03: I need quietness.

22/05/21, 16:04: I also feel like taking medication but I would rather write about the thoughts than taking an untimely doze of anti-anxiety medicine.

22/05/21, 16:05: It is also likely that I am sensitive to sounds in the environment today, these days, this past month, at this moment.

22/05/21, 16:07: The sound that I hear now seems to be that of a heavyweight vehicle with large engine.
Maybe it could be a crane.

22/05/21, 16:08: Now, exactly now, the water purifier started its activity and is making noise (that means it is refilling).
Sound is like a hum.

22/05/21, 16:09: After writing this much, I feel sleepy already.

22/05/21, 16:09: Am gonna sleep.

23/05/21, 12:18: Loud music playing in indoor gym (tenor's gym) next to my room in 243, MDC6.

29/05/21, 15:09: +++

29/05/21, 15:10: As Harsh plays loud music during his own workout, I also do workout.
"When life hands you a lemon, you make lemonade."

Tags: Journal,Behavioral Science,Emotional Intelligence,Psychology,Indian Politics,