Difference between revisions of "Documentation:How to use the Parser"

From Timeline of History
Jump to navigation Jump to search
Line 53: Line 53:
[[File:Presidents_Almost_Done.png|800px]]
[[File:Presidents_Almost_Done.png|800px]]


Now you can click ‘Format dates’ button to change  
Now you can click ‘Format dates’ button to change date format:


[[File:PresidentsResult.png|400px]]


James K. Polk;;;;March 4, 1845;March 4, 1849;


James K. Polk;;;;03.04.1845;03.04.1849;


Now everything looks right. Copy the result and paste it into the Editor.  
Now everything looks right. Copy the result and paste it into the Editor.  


A harder task
==A harder task==
Now that was easy. And the reason it was easy is that we got lucky that all US presidents were enclosed in triple apostrophes, which made them easily distinguishable from other links. This is not usually the case however.  
Now that was easy. And the reason it was easy is that we got lucky that all US presidents were enclosed in triple apostrophes, which made them easily distinguishable from other links. This is not usually the case however.  


I didn’t want to look for another example so I just used the same source text but removed apostrophes from it. Let’s pretend that it was like that to begin with. Now there is nothing unique about the links that contain the names of US presidents.
I didn’t want to look for another example so I just used the same source text but removed apostrophes from it.  
 
 
Let’s pretend that it was like that to begin with. Now there is nothing unique about the links that contain the names of US presidents.

Revision as of 07:28, 10 June 2021

Before reading this article you need to be familiar with the basic syntax of events in a layer, which is described here.

You can open the Parser by clicking the Parser button in the bottom right corner of the Editor.

ParserButton.png

This is what the Parser looks like:

ParserEmpty.png

The workflow

You need to put the source text (usually wiki text from a Wikipedia article) in the left field. Then, using the buttons at the bottom you highlight the needed information in the text: event texts and dates. The techniques for doing that will be described in this article. After that you click ‘Move selected’ button and the data is moved into the right field. Usually you need to format the data a bit more using the buttons below the right text field and then you can copy the resulting text and paste it into the Editor so that you can test the data on the timeline.

Example

Let’s use US presidents as an example. Suppose you want to create a layer of US presidents (even though such layer already exists).

First, you’d go to the corresponding Wikipedia page and open its source wiki text.

EditSource.png

Then you’d copy the wiki text and paste it into the input field of the Parser.

PresidentsSourceText.png

Now you need to mark all the presidents with red color, and all the dates with orange color. You can see that in the left bottom corner of the screen there is a button that is red already. And it says ‘Texts’. Thats exactly what we need. That means we are in the text selection mode. To select dates you will need to change the mode to single date selection mode or double dates selection mode. For now don’t do anything with the red button.

If you click ‘Select’ button, by default all the links will be selected:

PresidentsTooMuchLinks.png

You can manually unhighlight all the links that you don’t need (by selecting a range of text containing the highlighted parts and pressing Option/Alt key on the keyboard), but that’s too much work.

Instead let’s do something else. First, clear the selection by clicking ‘Clear’ button.

Now let’s pay attention to the fact that all the links containing presidents’ names are enclosed in triple apostrophes like this:  '''[[George Washington]]'''. We can use this fact to our advantage.

Put prefix '''[[ and postfix ]]''' in the two small input fields, and then click Select button.

PrefixPostfixExample.png

Now only the presidents are highlighted.

Presidents Links.png

Click on the red button to change it to orange. To find dates just click the ‘Find dates’ button. As you can see all the dates are highlighted, even the ones we don’t need.

PresidentsTooMuchDates.png

Now you have to manually unhighlight the ones that are not needed, by selecting parts of text with a mouse and pressing Option/Alt button.

Once you are done, you can click ‘Move selected’ and the data will be moved into the right field with almost correct syntax.

Presidents Almost Done.png

Now you can click ‘Format dates’ button to change date format:

PresidentsResult.png


Now everything looks right. Copy the result and paste it into the Editor.

A harder task

Now that was easy. And the reason it was easy is that we got lucky that all US presidents were enclosed in triple apostrophes, which made them easily distinguishable from other links. This is not usually the case however.

I didn’t want to look for another example so I just used the same source text but removed apostrophes from it.


Let’s pretend that it was like that to begin with. Now there is nothing unique about the links that contain the names of US presidents.