A
A
Alexey2018-08-07 08:46:53
Algorithms
Alexey, 2018-08-07 08:46:53

How to write an algorithm for generating the full and correct name of the street, square, etc.?

There is a database of all addresses: regions, districts, cities, streets - FIAS https://fias.nalog.ru/Updates.aspx
There you can find "streets" objects, where the name and type of the street (square, lane, avenue) are indicated
. with different names it is more customary to write a prefix like a street either before the name or after it.
For example:
Red Square and Revolution Square .
Vernadsky Avenue, Sheremetevsky Avenue.
Krasnaya street, Krasilnikov street
I wonder if there is such an algorithm to pull out the correct (human-understandable) spelling of the street?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-08-07
Madzhugin @Suntechnic

You can try to rely on inflection in the name of the object. To select them, you will have to sketch some kind of library, and take any stemmer as a basis. If you are doing on js, then there is a Yandex stemmer that is fast and simple.
It is best to rely on the affix stemmer.
When you have a word suffix, you will need to select the ending from it. This is already quite simple, and if you have an affix-stemmer, then the ending somewhere in it will already be highlighted.
Well, then the rule is partially selected from your own example - the ending "aya" for feminine objects - we add the type at the end. The ending "th" for masculine objects is the type at the beginning.
The name contains the word "name" or "them." then the type is placed before it.
And so on - you will need a table ending / type of object and at the intersections the position of the type relative to the name.
This will be the main way.
+ will be preliminary - if the title is two or three words and contains the word "name".
+ a table of special cases through which you will specify a few exceptions (which are likely to be).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question