Categories
data python tools

Swahili text normalizer

One of the challenges with working with text corpus, that will be used for voice datasets, is that you will encounter non-standard text like percentages, numbers, time and date. These can be a challenge when one has to read them. For example 23 could be read as twenty three or two three. To fix such an issue you do what is called text normalization during the cleaning and validation stage for your text corpus. This is helpful especially when your text corpus will be used for speech use cases.

Text normalization in speech applications converts written, non-standard text (like numbers, symbols, and abbreviations) into spoken-word forms for text-to-speech (TTS), or structures raw audio transcripts into clean data for automatic speech recognition (ASR)

During my fellowship with Mozilla Foundation working on the common voice text corpus for Kiswahili, this is something I encountered during the sentence validation stage. On the common voice platform, one way one can contribute to building the Swahili voice dataset is to read sentences in the Swahili language. The sentences went through a validation stage before they were ready for reading. You can see that encountering something like 3.5% might slow the reader (silence in the voice clip making it longer) or present a challenge of how to read the percentage. For English you can use already existing natural language processing tools to do text normalization.

I spent some time working on a small library for the Swahili language. Its a small collection of utilities that convert:

  • Numbers to words (0 .. < 1e9)
  • Years, dates, times to words
  • Decimals, percentages to words

You can find the source code here https://github.com/bmwasaru/kiswahili-text-normalizer and the readme file has instructions on how to install and use it. Here is an example usage:


>>> import kiswahili_text_normalizer as ktn
>>> text = "Tutakutane 20/11/2025 14:30, malipo ni 12.5%."
>>> print(ktn.normalize_text(text, profile="asr"))
tutakutane tarehe ishirini mwezi wa kumi na moja mwaka elfu mbili ishirini na tano 
saa nane na nusu malipo ni asilimia kumi na mbili nukta tano

As you can see it converts

  • 20/11/2025 to tarehe ishirini mwezi wa kumi na moja mwaka elfu mbili ishirini na tano
  • 14:30 to saa nane na nusu
  • 12.5% asilimia kumi na mbili nukta tano

You will note it adds keywords like tarehe to denote date, saa to denote time, nukta to denote decimal point and asilimia to denote percentage.

I have used this on text that I had scrapped from the Voice of America Swahili news website before it shutdown. The code for that can be found here https://github.com/bmwasaru/voa/blob/main/scripts/normalize_text.py. This was a perfect use case because this was a large text corpus and the normalizer was able to quickly find and convert. Side note, if you are looking for Swahili language text you can find the scraped text in cvs files here https://github.com/bmwasaru/voa/tree/main/sentences.

I hope one finds this useful and please share some feedback 🙂

Categories
poetry

home-made anxiety

4 hours of sleep
irregular sleeping patterns
2 cups of espresso, home-made
5 hours of screen time, mobile
notifications pushed, tick-tock
football on the big screen
unknown future beckons
all home-made anxiety

Categories
phography

love is for free, a zine.

Here is a collection of photos taken using my phone camera. They were all taken while I was on the move as the cool kids call it “touching grass”. So the theme is mobile, black and white photography and unplanned.

Categories
quote

authentic sin of impatience

“As Kafka prophesied, our one authentic sin is impatience: that is why we are forgetting how to read. Impatience increasingly is a visual obsession; we want to see a thing instantly and then forget it. Deep reading is not like that; reading requires patience and remembering. A visual culture cannot distinguish between fallen and unfallen angels, since we cannot see either and are forgetting how to read ourselves, which means that we can see images of others, but cannot really see either others or ourselves.”

by Harold Bloom, in the book Fallen Angels

Categories
quote thoughts

politics, systematic organization of hatreds

Politics, as a practice, whatever its professions, had always been the systematic organization of hatreds

Henry Adams, Education of Henry Adams

Came across this while going through the open Yale University political philosophy first lecture on youtube.

It’s interesting when you look at Kenya’s politics. Moi was removed on the “Yote yawezekana bila Moi” (all is possible without Moi) narrative. The opposition rallied all parties behind this movement and promised a corrupt free regime. After Kibaki’s two terms marked with a post election violence, goldenberg scandal, free education and a mix of bags. We got Uhuru Kenyatta and his running mate (now president) who were facing charges at the International Criminal Court. During his campaign, we got the anti-west campaign plus Cambridge Analytica stirring emotions against the other side. By pushing I mean personally attacks against Raila Odinga on the internet.

During Uhuru’s second term we see what was said to be internal issues come out in public with his deputy getting sidelined. What does Ruto do? He starts “anti-establishment” campaign, the hustler narrative pitting the wealthy against the majority. He even used a wheelbarrow as a symbol that work is work. He wins.

As I write this after protests against Ruto’s administration from financial bills that are over taxing the citizens to selling off public parastatals to everything getting worse and expensive. The education system is not working, fires in schools have become an often occurrence. Many cases of femicides and children disappearing and even ending up dead. We now have a Ruto Must Go narrative to galvanize the opposition against him. The other side is not even presenting any policies or a plan to get us out of the hole we are in.

Is the politics a play on people emotions. Raila was know to get people carried away with his vitendawili (riddles). Nothing changes just the players. Is the tyranny of a majority a problem or is also the solidarity needed to getting real change. As many have argued change doesn’t come from changing the person at the top.

One could ask, do people vote for or do they vote against someone?

Categories
photography

morning on the beach

Categories
quote thoughts

A.I Slop

I was wondering why people enjoyed A.I slop. From time to time, I would come across a mobile phone contact who would post some weird A.I generated video especially of cats talking or babies talking and I would wonder why they don’t find the videos gross and weird. 

Then I came across David Foster Wallace’s famous essay on television, “E Unibus Pluram“, in which he writes:

TV is the epitome of Low Art in its desire to appeal to and enjoy the attention of unprecedented numbers of people. But it is not Low because it is vulgar or prurient or dumb. Television is often all these things, but this is a logical function of its need to attract and please Audience. And I’m not saying that television is vulgar and dumb because the people who compose Audience are vulgar and dumb. Television is the way it is simply because people tend to be extremely similar in their vulgar and prurient and dumb interests and wildly different in their refined and aesthetic and noble interests.

Key to me here is this:

Television is the way it is simply because people tend to be extremely similar in their vulgar and prurient and dumb interests and wildly different in their refined and aesthetic and noble interests.

Could this also apply to the current appeal to A.I slop and why it’s got a lot of people generating the slop.

So why does this matter to me? I use artificial intelligence in some form or another on the daily. Thing is when you have spent years working with artists, taught yourself to do sketches, got paid to design posters and even developed an interesting in photography, you cannot help but easily identify how unappealing A.I generated media is. Also you cannot help but worry about how their top notch skills are substituted for slop. For example one of the leading stationery brand in Kenya, Karatasi Brand, is using generative images on the cover of their exercise books and social media. Ketepa Tea another leading company used A.I generated media for their Valentine’s Day campaign and it backfired. Many pointed out how the images of the tea bags in the photos they used didn’t even match their own tea bags and people wondered how they were not even able to notice this. These are brands that can pay for creatives to create content for them and maintain the brand they already have. Or does the marketing department think we won’t notice?

My other problem is that we have a large group of social media content consumers who cannot identify A.I generated content. There is the “aunty” who will always forward messages on WhatsApp only for you to point out that it’s fake. Your pointing out of this will be challenged and you might be called the “know it all”. In discussions around A.I regulation I have seen glimpse of suggestions of policies around watermarking A.I generated content as A.I generated content plus need to train consumers to see and understand this labels. I have seen introduction of these “Made with AI” or “AI info” labels.

According to Forbes (https://www.forbes.com/sites/phoebeliu/2025/11/10/openai-spending-ai-generated-sora-videos/), Open AI was spending around $15 million per day to run Sora, their A.I video generating platform. That’s a lot of money to let people generate “silly” videos. Wonder what this says about the industry.

Categories
poetry

THE ONLY WAR THAT MATTERS IS THE WAR AGAINST THE IMAGINATION

Below is a reading of a poem titled “Rant” by the amazing Diane di Prima. Read by the author.

Here is the text:

You cannot write a single line without a cosmology
a cosmogony
laid out, before all eyes

there is no part of yourself you can separate out
saying, this is memory, this is sensation
this is the work I care about, this is how I
make a living

it is whole, it is a whole, it always was whole
you do not “make” it so
there is nothing to integrate, you are a presence
you are an appendage of the work, the work stems from
hangs from the heaven you create

every man / every woman carries a firmament inside
and the stars in it are not the stars in the sky

without imagination there is no memory
without imagination there is no sensation
without imagination there is no will, desire

history is a living weapon in your hand
and you have imagined it, it is thus that you
“find out for yourself”
history is the dream of what can be, it is
the relation between things in a continuum

of imagination
what you find out for yourself is what you select
out of an infinite sea of possibility
no one can inhabit your world

yet it is not lonely,
the ground of imagination is fearlessness
discourse is video tape of a movie of a shadow play
but the puppets are in your hand
your counters in a multidimensional chess
which is divination
and strategy

the war that matters is the war against the imagination
all other wars are subsumed in it

the ultimate famine is the starvation
of the imagination

it is death to be sure, and the undead
seek to inhabit someone else’s world

the ultimate claustrophobia is the syllogism
the ultimate claustrophobia is “it all adds up”
nothing adds up and nothing stands in for
anything else

THE ONLY WAR THAT MATTERS IS THE WAR AGAINST
THE IMAGINATION
THE ONLY WAR THAT MATTERS IS THE WAR AGAINST
THE IMAGINATION
THE ONLY WAR THAT MATTERS IS THE WAR AGAINST
THE IMAGINATION
ALL OTHER WARS ARE SUBSUMED IN IT

there is no way out of a spiritual battle
there is no way you can avoid taking sides
there is no way you can not have a poetics
no matter what you do: plumber, baker, teacher

you do it in the consciousness of making
or not making your world
you have a poetics: you step into the world
like a suit of readymade clothes

or you etch in light
your firmament spills into the shape of your room
the shape of the poem, of your body, of your loves

a woman’s life / a man’s life is an allegory

dig it

there is no way out of the spiritual battle
the war is the war against the imagination
you can’t sign up as a conscientious objector

the war of the worlds hangs here, right now, in the balance
it is a war for this world, to keep it
a vale of soul-making

the taste in all our mouths is the taste of our power
and it is bitter as death

bring yourself home to yourself, enter the garden
the guy at the gate with the flaming sword is yourself

the war is the war for the human imagination
and no one can fight it but you and no one can fight it for you

the imagination is not only holy, it is precise
it is not only fierce, it is practical
men die everyday for the lack of it,
it is vast and elegant

intellectus means “light of the mind”
it is not discourse it is not even language
the inner sun

the polis is constellated around the sun
the fire is central

Categories
Book Review

2025 Reading List

Here is a list of some of the books I read in 2025 in no particular order

  1. A Comedy of Nobodies by Baron Ryan
  2. Means of Control by Byron Tau
  3. Azadi by Arundhati Roy
  4. Parfit by David Edmonds
  5. Attack Surface by Cory Doctorow
  6. Cult of the Dead Cow by Joseph Menn
  7. Thursdays by Jackson Biko
  8. Drank by Jackson Biko
  9. What Can and Cannot Be Said by John Cusack & Arundhati Roy
  10. The Doctor & the Saint by Arundhati Roy
  11. Memory Police by Yōko Ogawa
  12. The Boy Who Could Change the World by Aaron Swartz
  13. On Anarchism by Noam Chomsky
  14. Field Notes on Democracy by Arundhati Roy
  15. Thomas Sankara Speaks by Thomas Sankara
  16. Mutual Aid by Dean Spade
  17. Internet for the People by Ben Tarnoff
  18. Right to Oblivion by Lowry Pressly – the best book I read this year
  19. The People’s Platform by Astra Taylor
  20. Living in Data by Jer Thorp
  21. Designing Freedom by Stafford Beer
  22. We, the Scarred by Mukoma wa Ngugi
  23. Sandworm by Andy Greenberg
  24. The Stranger by Albert Marcus
  25. Islands in the Cyberstream by Joseph Weizenbaum and Gunna Wendt
Categories
thoughts

Slow down the engines

In an article titled “A practical utopians guide to the coming collapse” here https://davidgraeber.org/articles/a-practical-utopians-guide-to-the-coming-collapse/ David Graeber makes a case for slowing down. Quote here:

At the moment, probably the most pressing need is simply to slow down the engines of produc- tivity. This might seem a strange thing to say—our knee-jerk reaction to every crisis is to assume the solution is for everyone to work even more, though of course, this kind of reaction is really precisely the problem—but if you consider the overall state of the world, the conclusion becomes obvious. We seem to be facing two insoluble problems. On the one hand, we have witnessed an endless series of global debt crises, which have grown only more and more severe since the seven- ties, to the point where the overall burden of debt—sovereign, municipal, corporate, personal—is obviously unsustainable. On the other, we have an ecological crisis, a galloping process of cli- mate change that is threatening to throw the entire planet into drought, floods, chaos, starvation, and war. The two might seem unrelated. But ultimately they are the same. What is debt, after all, but the promise of future productivity? Saying that global debt levels keep rising is simply another way of saying that, as a collectivity, human beings are promising each other to produce an even greater volume of goods and services in the future than they are creating now. But even current levels are clearly unsustainable. They are precisely what’s destroying the planet, at an ever-increasing pace.

This was written in 2013, now in 2026 this sounds really like a strange thing to say to people. With new phones coming out every year, the artificial intelligence race and even the new usage of renewable energy as an alternative. The other day after another recent collapse of a mine in the Democratic Republic of Congo, I was thinking will we ever get out of the need for minerals that run these technologies. Even when you talk of renewable energy technology like solar panels or hybrid cars they still use minerals from the earth. The energy is renewable but the minerals are not. Apart from the pressure put on earth, the enormous pressure on the labour is dehumanizing. Kenyans are forming organizations to fight the human conditions that the data labellers are facing when training machine learning (or AI as many people call them) systems.

Sometimes it feels like the only progress we have are the shiny devices we get yearly. The human condition is not getting better. Yes, you can argue that even the shiny devices are making life worse. Maybe we really need to slow down.