We can use ANTLR beyond building an individual query language. In our next use case, we use it to transform textual data into plans and visualizations for real estate.
Our task was to create visualizations of real estate planning based on textual data from government institutions. Here’s what we were able to achieve by leveraging ANTLR4.
In the left column, we have input data: seemingly unclear textual data describing real estate planning in government institutions at first glance. In simple terms, these textual data define the direction of a line, which ultimately reflects comprehensive planning.
In the right column, we have transformed the input data into a real estate visualization, considering all the necessary parameters.
To develop our visualization, we first must decode the textual data. We begin with the following input data: CU14R2U17R20D17R2D14L24A1CR20X14A2R10D14CR10X4H.
If we break the input into separate parts, which can be considered as rooms, they would look like this:
Understanding the symbolic language is crucial for the effective interpretation and transformation of textual data.
After defining each rule, we decided to use a visitor pattern, overriding methods corresponding to each grammar rule. After processing by the visitors, we obtain a structure of objects. The parser class transforms textual data input into a list of objects representing shapes that will later be drawn.
So, we have the input data “CU14R2U17R20D17R2D14L24A1CR20X14A2R10D14CR10X4H” and need to transform it into a list of objects that can be visualized later. Let’s consider Room A: “CU14R2U17R20D17R2D14L24”.
After defining each room’s paths, the final stage is to convert the obtained list of lines with lengths and directions for visualization into [x, y] coordinates of the start and end of each line, considering that each room (Path) should be drawn from the zero point.
After that, choose a suitable graphics framework, such as Java AWT or a more modern Java FX, to draw the coordinates obtained, adding fill color for each room and displaying the length of each side additionally. The resulting canvas can be exported to the image format of your choice (.png, .jpg, etc.).
Using ANTLR, with its grammar and symbol recognition rules, we deciphered unreadable text into understandable shapes and lines representing a real estate plan. It's essential to emphasize that understanding the symbolic language used in the original text data is crucial for effectively transforming information.
Creating a grammar and rules that reflect the real nature of the data allowed us to interpret their essence accurately. Essentially, we transformed textual data into real estate plans and visualized them, providing a clear and convenient form for perception.
You can use ANTLR4 for various tasks depending on your project goals. Some uses of ANTLR4 include:
Our solution-oriented team can lend practical expertise to help you achieve your goals with tools like ATNLR. Reach out today to learn more about our software product development solutions.
We use cookies to bring best personalized experience for you. Check our Privacy Policy to learn more about how we process your personal data
Accept AllPrivacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website. More information