]> git.openstreetmap.org Git - nominatim.git/commitdiff
show token begin and end in debug output
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 28 Feb 2025 16:19:37 +0000 (17:19 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 4 Mar 2025 07:57:59 +0000 (08:57 +0100)
src/nominatim_api/search/icu_tokenizer.py

index 01513103dcc059f33ff84e46d5058660ad0db93a..09827826568cc98e397b79dd9ec8c3da79b4ff03 100644 (file)
@@ -298,12 +298,12 @@ class ICUQueryAnalyzer(AbstractQueryAnalyzer):
 
 
 def _dump_word_tokens(query: qmod.QueryStruct) -> Iterator[List[Any]]:
-    yield ['type', 'token', 'word_token', 'lookup_word', 'penalty', 'count', 'info']
-    for node in query.nodes:
+    yield ['type', 'from', 'to', 'token', 'word_token', 'lookup_word', 'penalty', 'count', 'info']
+    for i, node in enumerate(query.nodes):
         for tlist in node.starting:
             for token in tlist.tokens:
                 t = cast(ICUToken, token)
-                yield [tlist.ttype, t.token, t.word_token or '',
+                yield [tlist.ttype, str(i), str(tlist.end), t.token, t.word_token or '',
                        t.lookup_word or '', t.penalty, t.count, t.info]