Products

SIGN UPLOG IN

Models / Text / Misleading Username Detection

Misleading Username Detection

Overview

Misleading usernames are usernames that might mislead other users, for instance because they attempt to impersonate someone else, or because they try to mimic app features, actions or technical terms.

The Username Moderation API can therefore be used to detect misleading usernames and prevent users from choosing them.

Principles

DescriptionExamples

Impersonation of privileged users, employees

admin support

Common features and actions in apps and websites

about profile upgrade

Technical terms related to apps, websites and development

404 cgi-bin ubuntu

Commercial terms that are widely known

facebook

Please contact us to discuss other categories of misleading usernames and content.

Moderating Usernames with Sightengine

Let's say you want to moderate the following username: support232

Simply send a POST request containing the UTF-8 formatted username along with the moderation mode set at username. Here is an example:


curl -X POST 'https://api.sightengine.com/1.0/text/check.json' \
  -F 'text=support232' \
  -F 'lang=en' \
  -F 'mode=username' \
  -F 'api_user={api_user}' \
  -F 'api_secret={api_secret}'


# this example uses requests
import requests
import json

data = {
  'text': 'support232',
  'mode': 'username',
  'lang': 'en',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}'
}
r = requests.post('https://api.sightengine.com/1.0/text/check.json', data=data)

output = json.loads(r.text)


$params = array(
  'text' => 'support232',
  'lang' => 'en',
  'mode' => 'username',
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',
);

// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/text/check.json');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$response = curl_exec($ch);
curl_close($ch);

$output = json_decode($response, true);


// this example uses axios and form-data
const axios = require('axios');
const FormData = require('form-data');

data = new FormData();
data.append('text', 'support232');
data.append('lang', 'en');
data.append('mode', 'username');
data.append('api_user', '{api_user}');
data.append('api_secret', '{api_secret}');

axios({
  url: 'https://api.sightengine.com/1.0/text/check.json',
  method:'post',
  data: data,
  headers: data.getHeaders()
})
.then(function (response) {
  // on success: handle response
  console.log(response.data);
})
.catch(function (error) {
  // handle error
  if (error.response) console.log(error.response.data);
  else console.log(error.message);
});

See request parameter description

ParameterTypeDescription
textstringUTF-8 encoded text to moderate
modestringcomma-separated list of modes. Modes are rules for the rule-based model or ml for ML models
categoriesstringcomma-separated list of categories to check. Possible values: profanity, personal, link, drug, weapon, violence, self-harm, medical, extremism, spam, content-trade, money-transaction (optional)
langstringcomma-separated list of target languages
opt_countriesstringcomma-separated list of target countries for phone number detection (optional)
liststringid of a custom list to be used for rule-based moderation (optional)
api_userstringyour API user id
api_secretstringyour API secret

The request response will contain a JSON body that you can then use to determine if the username was acceptable or not.

If the username is detected as being potentially misleading, details will be provided under the misleading key.

As an example, here is the JSON request that you would receive for the above request:


{
  "status": "success",
  "request": {
    "id": "req_6cujQglQPgGApjI5odv0P",
    "timestamp": 1471947033.92,
    "operations": 1
  },
  "profanity": {
    "matches": []
  },
  "personal": {
    "matches": []
  },
  "link": {
    "matches": []
  },
  "misleading": {
    "matches": [
      "type": "misleading",
      "match": "support",
      "start": 0,
      "end": 10
    ]
  }
}

As you can see, Username moderation will also detect if the username contains profanity.

Any other needs?

See our full list of Text models for details on other filters and checks you can run on your text content. You might also want to check our Image & Video models to moderate images and videos. This includes moderation of text in images/videos.

Was this page helpful?