| 1858 | } |
| 1859 | |
| 1860 | void Geocoder::MatchUnclassified(BaseContext & ctx, size_t curToken) |
| 1861 | { |
| 1862 | TRACE(MatchUnclassified); |
| 1863 | |
| 1864 | ASSERT(ctx.m_layers.empty(), ()); |
| 1865 | |
| 1866 | // We need to match all unused tokens to UNCLASSIFIED features, |
| 1867 | // therefore unused tokens must be adjacent to each other. For |
| 1868 | // example, as parks are UNCLASSIFIED now, it's ok to match "London |
| 1869 | // Hyde Park", because London will be matched as a city and rest |
| 1870 | // adjacent tokens will be matched to "Hyde Park", whereas it's not |
| 1871 | // ok to match something to "Park London Hyde", because tokens |
| 1872 | // "Park" and "Hyde" are not adjacent. |
| 1873 | if (ctx.NumUnusedTokenGroups() != 1) |
| 1874 | return; |
| 1875 | |
| 1876 | Retrieval::ExtendedFeatures allFeatures; |
| 1877 | allFeatures.SetFull(); |
| 1878 | |
| 1879 | curToken = ctx.SkipUsedTokens(curToken); |
| 1880 | auto startToken = curToken; |
| 1881 | for (; curToken < ctx.NumTokens() && !ctx.IsTokenUsed(curToken); ++curToken) |
| 1882 | allFeatures = allFeatures.Intersect(ctx.m_features[curToken]); |
| 1883 | |
| 1884 | if (m_filter->NeedToFilter(allFeatures.m_features)) |
| 1885 | { |
| 1886 | allFeatures.m_features = m_filter->Filter(allFeatures.m_features); |
| 1887 | allFeatures.m_exactMatchingFeatures = m_filter->Filter(allFeatures.m_exactMatchingFeatures); |
| 1888 | } |
| 1889 | |
| 1890 | auto emitUnclassified = [&](uint32_t featureId, bool exactMatch) |
| 1891 | { |
| 1892 | Model::Type type; |
| 1893 | if (!GetTypeInGeocoding(ctx, featureId, type)) |
| 1894 | return; |
| 1895 | if (type == Model::TYPE_UNCLASSIFIED) |
| 1896 | { |
| 1897 | auto const tokenRange = TokenRange(startToken, curToken); |
| 1898 | ScopedMarkTokens mark(ctx.m_tokens, BaseContext::TOKEN_TYPE_UNCLASSIFIED, tokenRange); |
| 1899 | EmitResult(ctx, {m_context->GetId(), featureId}, type, tokenRange, nullptr /* geoParts */, |
| 1900 | true /* allTokensUsed */, exactMatch); |
| 1901 | } |
| 1902 | }; |
| 1903 | allFeatures.ForEach(emitUnclassified); |
| 1904 | } |
| 1905 | |
| 1906 | CBV Geocoder::RetrievePostcodeFeatures(MwmContext const & context, TokenSlice const & slice) |
| 1907 | { |
nothing calls this directly
no test coverage detected