{
  "id": 9601,
  "title": "what python program is doing",
  "url": "/competitions/avito-prohibited-content/discussion/9601",
  "author_name": "",
  "post_date": "2014-06-28T06:42:13.860Z",
  "votes": null,
  "comment_count": 5,
  "views": 1694,
  "content": "<p>Hi ,</p>\n<p>Can someone explain what python program is doing , As per my knowledge it is taking the item and description words and creating a sparse matrix and running the&nbsp;SGDClassifier . what else is going on in this program ?,</p>\n<p>are russian characters are getting converted to english character ?</p>",
  "messages": [
    {
      "id": "49757",
      "postDate": "06/28/2014 06:42:13",
      "content": "<p>Hi ,</p>\n<p>Can someone explain what python program is doing , As per my knowledge it is taking the item and description words and creating a sparse matrix and running the&nbsp;SGDClassifier . what else is going on in this program ?,</p>\n<p>are russian characters are getting converted to english character ?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49873",
      "postDate": "06/30/2014 17:35:33",
      "content": "<p>In the sample program, the words in the title and description are being taken into consideration. Each word acts as a binary feature.&nbsp;</p>\n\n<p>Let us know if you need help with anything specific in the program.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "50736",
      "postDate": "07/16/2014 21:50:56",
      "content": "<p>[quote=Phani Vadrevu;49873]</p>\n<p>In the sample program, the words in the title and description are being taken into consideration. Each word acts as a binary feature.&nbsp;</p>\n<p>Let us know if you need help with anything specific in the program.&nbsp;</p>\n<p>[/quote]</p>\n<p>Hi,</p>\n<p>I don't think that each&nbsp;word acts as a binary feature.</p>\n<p>Looking at the given code each word can enter more than once for each item and in that case the entry in the sparse matrix will be greater than one.</p>\n<p>Take a look at that code:</p>\n<p><code>from scipy.sparse import *<br>from scipy import *<br>import numpy as np<br>row = array([0,0,1,2,2])<br>col = array([0,2,2,1,1])<br>m = csr_matrix( (np.ones(len(row)),(row,col)), shape=(3,3) ).todense()</code></p>\n<p>row=2, col=1 has two entries so the resulted matrix will have the value 2 at cell (2,1).</p>\n<p><code>m = matrix([[ 1., 0., 1.],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ 0., 0., 1.],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ 0., 2., 0.]])</code></p>\n<p>Hope that helps.</p>\n<p>C</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "50773",
      "postDate": "07/17/2014 13:16:56",
      "content": "<p><em>are russian characters are getting converted to english character ?</em></p>\n<p>The issue with Russian/English - or Cyrillic/Latin characters is a technique fraudsters use to bypass automated word detection. These characters look the same in both alphabets, but their codes are different.</p>\n<p>So if a word in Cyrillic is written such as: &#1053;&#1072;&#1095;&#1085;&#1080;&#1090;&#1077; these would be all character codes from Cyrillic code page, but fraudsters would replace latter &#1085; for example with Latin H because it looks the same. The ASCII code for Latin H is different to Cyrillic &#1085; so the auto-detection may miss the word, unless this replacement is made beforehand.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "50793",
      "postDate": "07/17/2014 18:14:32",
      "content": "<p>[quote=Jano Petras;50773]</p>\n<p><em>are russian characters are getting converted to english character ?</em></p>\n<p>The issue with Russian/English - or Cyrillic/Latin characters is a technique fraudsters use to bypass automated word detection. These characters look the same in both alphabets, but their codes are different.</p>\n<p>So if a word in Cyrillic is written such as: &#1053;&#1072;&#1095;&#1085;&#1080;&#1090;&#1077; these would be all character codes from Cyrillic code page, but fraudsters would replace latter &#1085; for example with Latin H because it looks the same. The ASCII code for Latin H is different to Cyrillic &#1085; so the auto-detection may miss the word, unless this replacement is made beforehand.</p>\n<p>[/quote]</p>\n<p>In the `correctWord` function, I notice that eng2rus replacement is done only&nbsp;when there's more Cyrillic characters than Latin characters, and rus2eng replacement is done only when there's more Latin characters. Do you know why?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "50794",
      "postDate": "07/17/2014 18:37:58",
      "content": "<p>It was mentioned that the fraudsters use this technique to evade autoamatic detection systems.&nbsp;</p>\n<p>Think about how it works. If I am a fraudster and I would like to sell some porn material which is illegal, I will try to use the word 'p&#1086;rn' instead of 'porn' in the description. Notice I used the Cyrillic '&#1086;' instead of Latin 'o'. From the fraudster's perspective, its only enough to change as few characters with look-alike characters. Even one change should be good enough to escape detection.&nbsp;</p>\n<p>Vice-versa follows for original Russian text that needs to be hidden.&nbsp;I am guessing that that's why we should convert all characters to the alphabet that has more characters originally.</p>\n<p>EDIT: I just realized that I explained the opposite thing. Sorry, I don't know why it is being done this way!</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 49873,
      "author_name": "phanivadrevu",
      "author_url": "",
      "post_date": "06/30/2014 17:35:33",
      "content": "<p>In the sample program, the words in the title and description are being taken into consideration. Each word acts as a binary feature.&nbsp;</p>\n\n<p>Let us know if you need help with anything specific in the program.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 50736,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "07/16/2014 21:50:56",
      "content": "<p>[quote=Phani Vadrevu;49873]</p>\n<p>In the sample program, the words in the title and description are being taken into consideration. Each word acts as a binary feature.&nbsp;</p>\n<p>Let us know if you need help with anything specific in the program.&nbsp;</p>\n<p>[/quote]</p>\n<p>Hi,</p>\n<p>I don't think that each&nbsp;word acts as a binary feature.</p>\n<p>Looking at the given code each word can enter more than once for each item and in that case the entry in the sparse matrix will be greater than one.</p>\n<p>Take a look at that code:</p>\n<p><code>from scipy.sparse import *<br>from scipy import *<br>import numpy as np<br>row = array([0,0,1,2,2])<br>col = array([0,2,2,1,1])<br>m = csr_matrix( (np.ones(len(row)),(row,col)), shape=(3,3) ).todense()</code></p>\n<p>row=2, col=1 has two entries so the resulted matrix will have the value 2 at cell (2,1).</p>\n<p><code>m = matrix([[ 1., 0., 1.],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ 0., 0., 1.],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ 0., 2., 0.]])</code></p>\n<p>Hope that helps.</p>\n<p>C</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 50773,
      "author_name": "janopetras",
      "author_url": "",
      "post_date": "07/17/2014 13:16:56",
      "content": "<p><em>are russian characters are getting converted to english character ?</em></p>\n<p>The issue with Russian/English - or Cyrillic/Latin characters is a technique fraudsters use to bypass automated word detection. These characters look the same in both alphabets, but their codes are different.</p>\n<p>So if a word in Cyrillic is written such as: &#1053;&#1072;&#1095;&#1085;&#1080;&#1090;&#1077; these would be all character codes from Cyrillic code page, but fraudsters would replace latter &#1085; for example with Latin H because it looks the same. The ASCII code for Latin H is different to Cyrillic &#1085; so the auto-detection may miss the word, unless this replacement is made beforehand.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 50793,
      "author_name": "apophenia",
      "author_url": "",
      "post_date": "07/17/2014 18:14:32",
      "content": "<p>[quote=Jano Petras;50773]</p>\n<p><em>are russian characters are getting converted to english character ?</em></p>\n<p>The issue with Russian/English - or Cyrillic/Latin characters is a technique fraudsters use to bypass automated word detection. These characters look the same in both alphabets, but their codes are different.</p>\n<p>So if a word in Cyrillic is written such as: &#1053;&#1072;&#1095;&#1085;&#1080;&#1090;&#1077; these would be all character codes from Cyrillic code page, but fraudsters would replace latter &#1085; for example with Latin H because it looks the same. The ASCII code for Latin H is different to Cyrillic &#1085; so the auto-detection may miss the word, unless this replacement is made beforehand.</p>\n<p>[/quote]</p>\n<p>In the `correctWord` function, I notice that eng2rus replacement is done only&nbsp;when there's more Cyrillic characters than Latin characters, and rus2eng replacement is done only when there's more Latin characters. Do you know why?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 50794,
      "author_name": "phanivadrevu",
      "author_url": "",
      "post_date": "07/17/2014 18:37:58",
      "content": "<p>It was mentioned that the fraudsters use this technique to evade autoamatic detection systems.&nbsp;</p>\n<p>Think about how it works. If I am a fraudster and I would like to sell some porn material which is illegal, I will try to use the word 'p&#1086;rn' instead of 'porn' in the description. Notice I used the Cyrillic '&#1086;' instead of Latin 'o'. From the fraudster's perspective, its only enough to change as few characters with look-alike characters. Even one change should be good enough to escape detection.&nbsp;</p>\n<p>Vice-versa follows for original Russian text that needs to be hidden.&nbsp;I am guessing that that's why we should convert all characters to the alphabet that has more characters originally.</p>\n<p>EDIT: I just realized that I explained the opposite thing. Sorry, I don't know why it is being done this way!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "49757": "",
    "49873": "",
    "50736": "",
    "50773": "",
    "50793": "",
    "50794": ""
  },
  "source": "meta"
}