Tag Identifier


Service «Tag Identifier» is designed to obtain supporting information about the tags in the text. At the entrance of the service, you can submit arbitrary text or a sequence of characters with tags. At the output, the user receives the following supporting information about the tags in the text:

  • a list of tags (single or only opening) according to the order in which they occur in the text;
  • frequency of use of each tag (in brackets next to the tag name);
  • the part of the code that contains the listed tag, and in it:
    • context of use (black);
    • tag content from opening to closing (red).

 

Practical value

The service helps to navigate large texts of html markup: check for the presence of a specific tag, the closeness of the tag, its content and context of use, and thus detect errors in the markup.

 

Interface Description

The graphical interface of the service presented in Figure 1.

 

Figure 1. Interface of the service «Tag Identifier»

 

The interface contains the following areas:

  • electronic text entry field;
  • a setting field that allows you to:
    • search only specific tag;
    • enter the number of characters of the context;
  • the button «Find tags!», which starts text processing and gives you the opportunity to get results;
  • output data field.

 

User script for working with the service

Option 1. Search all tags in the text.

  1. Type in the text box with text tags.
  2. Enter the required number of context characters or leave the default value (300).
  3. Click the Find Tags button to get the totals (Figure 2).

An example of the final data is presented in Figure 2.

Figure 2. The results of the service «Tag Identifier»

 

Option 2. Search for a specific tag.

  1. Type in the text box with text tags.
  2. Enter one required tag without brackets, for example, html or p.
  3. Enter the required number of context characters or leave the default value (300).
  4. Click the «Find Tags!» button to get summary data (images 3, 4).

 

Figure 3. Search results tag «html»

 

Figure 4. Search results tag «p»

 

Access to the service via the API

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

  • inputText — arbitrary input text.
  • certainTag — tag to search if the result for a specific tag is needed.
  • contextSize — context size in the number of characters to the right and left of the found tags.

Example of AJAX-request:

$.ajax({
   type: “POST”,
   url: “https://corpus.by/TagIdentifier/api.php”,
   data:{
      “text”: “<!DOCTYPE html>\n<html>\n<head>\n<title>Page Title</title>\n</head>\n<body>\n<h1>This is a first Heading.</h1>\n<p>This is a first paragraph.</p>\n<h1>This is a second Heading.</h1>\n<p>This is a second paragraph.</p>\n</body>\n</html>”,
      “certainTag“: “title”,
      “contextSize“: 10
   },
   success: function(msg){ },
   error: function() { }
});

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

  • text — input text.
  • result — resulting text.

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

[
   {
      “text”: “<!DOCTYPE html>\n<html>\n<head>\n<title>Page Title</title>\n</head>\n<body>\n<h1>This is a first Heading.</h1>\n<p>This is a first paragraph.</p>\n<h1>This is a second Heading.</h1>\n<p>This is a second paragraph.</p>\n</body>\n</html>”,
      “result”: “<b><font color=”red”>&lt;title&gt;</font></b> (1)<br><br>\n&lt;head&gt;\n<font color=”red”>&lt;title&gt;Page Title&lt;/title&gt;</font>\n&lt;/head&gt;\<br><br><br>”
   }
]

 

References to sources

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

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