Table Processor


The service “Table processor” is intended for the conversion of initial data into table view and for resulting table processing. The external interface of the service is shown in Figure 1. At the service entrance, you can submit data in a specific format that interests the user. To get a table with user information, you need to click on the “Show table!”

 

Figure 1 – Appearance of the service “Table Processor”

 

The service processes the input information as an input and, as a result, presents the user with the following table view, which is shown in Figure 2.

 

Figure 2 – The result of the service “Table Processor”

 

The service also provides the user with the opportunity not only to create a table of initial data, but also to process it. Additional service functions are presented in Figure 3. These include the ability to delete, for example, column 4 (Figure 5) and reverse column (or columns), for example, 2 and 4 (Figure 4). The service allows you to gradually (one by one) delete the column. The method and results are presented in the corresponding figures. These functions are after the button “Show table!”

 

Figure 3 – Additional features of service

 

Figure 4 – The method and result of changes in place of columns

 

Figure 5 – Method and result of deleting one of the columns

 

Note! During the initial data collection, the service itself does not divide the information into columns. To form columns, you need to separate the data with a special character that can be simply copied (first selecting it, as shown in Figure 6) and inserted between, for example, words that should be in different columns. If the user does not put this sign, the source data will not be distributed among the columns in the table (or this will be done incorrectly).

 

Figure 6 – The symbol of the “breakdown” of the data into columns (highlighted in blue)

 

Figure 7 shows the result of the service with user data, which was formatted using the “separator” symbol, which is discussed in Figure 6.

 

Figure 7 – Result of the service with user data (with formatting)

 

Access to the service via the API

To access the service «Table Processor» via the API, you should send an AJAX-request (type: POST) to the address https://corpus.by/TableProcessor/api.php. With an input array data the following parameters are passed:

  • tableText — table in a text view, where each line of text is a table row.
  • delimiter — character that serves as cell delimiter in a table row. Available variants:
    • 0 — tabulation.
    • 1 — space.
    • 2 — new line.
    • 3 — comma.
  • mode — table processing action. Available variants:
    • showTable — create a table in html-format based on a text representation.
    • swapColumns — swap certain columns.
    • deleteColumns — delete certain column.

Additional options:

  • swap_column_1 і swap_column_2 — numbers of columns to be swapped (with mode — swapColumns).
  • delete_column — numbers of column to be deleted (with mode — deleteColumns).

Example of AJAX-request:

$.ajax({
   type: “POST”,
   url: “https://corpus.by/TableProcessor/api.php”,
   data:{
      “tableText”: “№ Назва Назва паводле сузор’я Адлегласць, св. гадоў Бачная зорная велічыня Паўшар’е
0 Сонца – 0,0000158 −26,72
1 Сірыус α Вялікага Сабакі 8,6 −1,46 Паўднёвае
2 Канопус α Кіля 310 −0,72 Паўднёвае
3 Таліман α Цэнтаўра 4,3 −0,27 Паўднёвае
4 Арктур α Валапаса 34 −0,05(пераменная) Паўночнае
5 Вега α Ліры 25 0,03 (пераменная) Паўночнае
6 Капэла α Возніка 41 0,08 Паўночнае
7 Рыгель β Арыёна ~870 0,12 (пераменная) Паўднёвае
8 Працыён α Малога Сабакі 11,4 0,38 Паўночнае
9 Ахернар α Эрыдана 69 0,46 Паўднёвае
10 Бетэльгейзэ α Арыёна ~530 0,50 (пераменная) Паўночнае”,

      “delimiter”: 0,
      “mode”: “showTable”
   },
   success: function(msg){ },
   error: function() { }
});

The server returns a JSON-array with the following parameters:

  • tableText — table in a text representation.
  • tableHtml — table in html-code representation.
  • functionality — html-page fragment with presentation of available functionality.

For example, the following reply will be formed on the above listed AJAX-request:

[
   {
      “tableText”: “<input type=”hidden” name=”tableText” value=”№ Назва Назва паводле сузор&#39;я Адлегласць, св. гадоў Бачная зорная велічыня Паўшар&#39;е

0 Сонца – 0,0000158 −26,72
1 Сірыус α Вялікага Сабакі 8,6 −1,46 Паўднёвае
2 Канопус α Кіля 310 −0,72 Паўднёвае
3 Таліман α Цэнтаўра 4,3 −0,27 Паўднёвае
4 Арктур α Валапаса 34 −0,05(пераменная) Паўночнае
5 Вега α Ліры 25 0,03 (пераменная) Паўночнае
6 Капэла α Возніка 41 0,08 Паўночнае
7 Рыгель β Арыёна ~870 0,12 (пераменная) Паўднёвае
8 Працыён α Малога Сабакі 11,4 0,38 Паўночнае
9 Ахернар α Эрыдана 69 0,46 Паўднёвае
10 Бетэльгейзэ α Арыёна ~530 0,50 (пераменная) Паўночнае>”,

      “tableHtml”: “<table width=”100%” class=”processing” align=”center”><tbody><tr><td>№</td>

<td>Назва</td><td>Назва паводле сузор’я</td><td>Адлегласць, св. гадоў</td><td>Бачная зорная велічыня</td><td>Паўшар’е
</td></tr><tr><td>0</td><td>Сонца</td><td>–</td><td>0,0000158</td><td>−26,72
</td><td></td></tr><tr><td>1</td><td>Сірыус</td><td>α Вялікага Сабакі</td><td>8,6</td><td>−1,46</td><td>Паўднёвае
</td></tr><tr><td>2</td><td>Канопус</td><td>α Кіля</td><td>310</td><td>−0,72</td><td>Паўднёвае
</td></tr><tr><td>3</td><td>Таліман</td><td>α Цэнтаўра</td><td>4,3</td><td>−0,27</td><td>Паўднёвае
</td></tr><tr><td>4</td><td>Арктур</td><td>α Валапаса</td><td>34</td><td>−0,05(пераменная)</td><td>Паўночнае
</td></tr><tr><td>5</td><td>Вега</td><td>α Ліры</td><td>25</td><td>0,03 (пераменная)</td><td>Паўночнае
</td></tr><tr><td>6</td><td>Капэла</td><td>α Возніка</td><td>41</td><td>0,08</td><td>Паўночнае
</td></tr><tr><td>7</td><td>Рыгель</td><td>β Арыёна</td><td>~870</td><td>0,12 (пераменная)</td><td>Паўднёвае
</td></tr><tr><td>8</td><td>Працыён</td><td>α Малога Сабакі</td><td>11,4</td><td>0,38</td><td>Паўночнае
</td></tr><tr><td>9</td><td>Ахернар</td><td>α Эрыдана</td><td>69</td><td>0,46</td><td>Паўднёвае
</td></tr><tr><td>10</td><td>Бетэльгейзэ</td><td>α Арыёна</td><td>~530</td><td>0,50 (пераменная)</td><td>Паўночнае</td></tr></tbody></table>”,

      “functionality”: “<h2 class=”sub-caption-smaller”>Памяняць месцамі слупкі:
<select id=”swap_column_1_id” name=”swap_column_1″>
<option value=”1″>Слупок №1</option><option value=”2″>Слупок №2</option><option value=”3″>Слупок №3</option><option value=”4″>Слупок №4</option><option value=”5″>Слупок №5</option><option value=”6″>Слупок №6</option> </select>
<select id=”swap_column_2_id” name=”swap_column_2″>
<option value=”1″>Слупок №1</option><option value=”2″>Слупок №2</option><option value=”3″>Слупок №3</option><option value=”4″>Слупок №4</option><option value=”5″>Слупок №5</option><option value=”6″>Слупок №6</option> </select>
<input type=”submit” id=”swap_columns_id” name=”swap_columns” class=”blue-button” value=”Памяняць!”>
<br>
</h2><h2 class=”sub-caption-smaller”>Выдаліць слупок:
<select id=”delete_column_id” name=”delete_column”>
<option value=”1″>Слупок №1</option><option value=”2″>Слупок №2</option><option value=”3″>Слупок №3</option><option value=”4″>Слупок №4</option><option value=”5″>Слупок №5</option><option value=”6″>Слупок №6</option> </select>
<input type=”submit” id=”delete_columns_id” name=”delete_columns” class=”blue-button” value=”Выдаліць слупок!”>
</h2>”

   }
]

 

Service page – https://corpus.by/TableProcessor/?lang=en

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.