Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
68a51203
Commit
68a51203
authored
Aug 28, 2021
by
Volker Krause
Browse files
Use the airport name tokenizer in the airport db generator as well
parent
b0b62f96
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/knowledgedb-generator/CMakeLists.txt
View file @
68a51203
...
...
@@ -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"
)
...
...
src/knowledgedb-generator/airportdbgenerator.cpp
View file @
68a51203
...
...
@@ -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
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment