The popular Chinese messaging app WeChat has been forced to apologize after an AI error resulted in it translating the Chinese phrase for “black foreigner” into the n-word.

The error was noticed by Shanghai-based theater actor Ann James, a black American. Writing on the app’s Twitter-like Moments feature, James showed how the words ‘hei laowai,’ meaning “black foreigner,” were being incorrectly translated into the racial slur.

Read more

Speaking to Chinese news site Sixth Tone, a spokesperson for WeChat, an app used by around 700 million people, apologized for the translation.

“We’re very sorry for the inappropriate translation,” the spokesperson said. “After receiving users’ feedback, we immediately fixed the problem.”

As the controversy grew, news site That’s Shanghai tested the AI feature and found it provided different translations depending on whether the context was positive or negative.

For example, when they entered the words “black foreigners are cool,” the app returned a correct translation. But if the the term was combined with the words “lazy” or “thief” then the n-word would appear instead.

Technology experts put this down to the machine-learning AI incorporating the biases of people using the app – a problem which has manifested in other apps.

In July 2015, Google apologized to two black people after its photo service, which automatically tagged uploaded pictures using its own AI software, mislabelled them as “gorillas.”

In August this year, Noel Sharkey, a director of the Foundation for Responsible Robotics, told the BBC’s Today program that machine-learning algorithms, far from making the world more equitable, are now mimicking society’s inherent biases against women and ethnic minorities.

Sharkey cited research from Boston University in which an AI was trained to read Google News. When asked during a word association game, “man is to computer programmer what woman is to x,” the computer replied “homemaker.”

READ MORE: Racist & sexist AI bots could deny you job, insurance & loans – tech experts

The WeChat incident was not the only racially charged scandal to emerge from China Friday.

The Hubei Provincial Museum in the city of Wuhan was forced to remove photographs from an exhibit after appearing to compare African people and animals, according to Channel News Asia.

A dozen pictures were removed from the “This is Africa” exhibition after video was posted online showing portraits of people set alongside animals, including a piece featuring a young boy and a chimpanzee, and another of an elderly man next to a monkey.

"To show our goodwill and sincerity, we have replaced the photos that our African friends find shocking," curator Wang Yuejun told AFP.