Commit 68a51203 authored by Volker Krause's avatar Volker Krause
Browse files

Use the airport name tokenizer in the airport db generator as well

parent b0b62f96
......@@ -13,6 +13,7 @@ add_executable(generate-knowledgedb
trainstationdbgenerator.cpp
util.cpp
../lib/stringutil.cpp
../lib/knowledgedb/airportnametokenizer.cpp
../lib/knowledgedb/stationidentifier.cpp
)
target_compile_definitions(generate-knowledgedb PRIVATE "KITINERARY_STATIC_DEFINE")
......
......@@ -8,6 +8,7 @@
#include "codegen.h"
#include "wikidata.h"
#include "../stringutil.h"
#include "../knowledgedb/airportnametokenizer_p.h"
#include <airportdb_p.h>
......@@ -222,16 +223,12 @@ void AirportDbGenerator::improveCoordinates()
}
}
void KItinerary::Generator::AirportDbGenerator::indexNames()
void AirportDbGenerator::indexNames()
{
for (auto it = m_airportMap.begin(); it != m_airportMap.end(); ++it) {
auto l = StringUtil::normalize(it.value().label + QLatin1Char(' ') + it.value().alias)
.split(QRegularExpression(QStringLiteral("[ 0-9/'\"\\(\\)&\\,.–„-]")),
Qt::SkipEmptyParts
);
std::for_each(l.begin(), l.end(), [](QString &s) {
s = s.toCaseFolded();
});
const auto normalized = StringUtil::normalize(QString(it.value().label + QLatin1Char(' ') + it.value().alias));
AirportNameTokenizer tokenizer(normalized);
auto l = tokenizer.toStringList();
normalizeAbbreviations(l);
std::sort(l.begin(), l.end());
l.removeAll(it.value().iataCode.toCaseFolded());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment