AILOOKUP is an AI-powered semantic search replacement for VLOOKUP.

Re-coding your data to match yet another classification is a common hurdle. AI can help do this work for you.

For example: AILOOKUP("Margarita pizza", "ISICrev4_3digit")

returns the following ISICrev4 3-digit code: {code: "G472", sector: "Retail sale of food, beverages and tobacco in specialized stores"}

Documentation on using this API in Google Sheets, Python, R, or almost any other language is provided below. A translation feature is integrated to allow searching in English or any of 100 other langauges. Email me to suggest other target classifications.

REST API URL:

https://ailookup.app/search/v1/?q=&query_lang=en&target=NACE2.1_level2&apikey=XXXXX&output=json
Using this tool:
  
  
  

For a demo of how to use this service with Google Sheets, look at this example: Example Google Sheet

You will use the IMPORTHTML() workbook function to access the API for this service. That workbook function takes three arguments:

  • url - The URL with your search keyword, target classificaiton, and API key. Read the documentation below on how to craft a URL for the REST API. Important: Be sure to include the output=html parameter in your request to get output compatible with Google Sheets!
  • query - Always use "table".
  • index - Which table number should be read. See the example worksheet to see which tables are available.

Read more:

REST API

Example request:

https://ailookup.app/search/v1/?q=bananas&apikey=1234

Base URL:

https://ailookup.app/search/v1/

Query Parameters:

  • q - a URL-encoded string containing the the product or sector, with optional country, to search for. Examples: bananas or bananas%20from%20ecduador.

    Tip: To URL-encode text you can use the function encodeURIComponent() in JavaScript, or the ENCODEURL() function in Google Sheets, or in Python use urllib.parse.quote().

  • target - The classification codename to use. The available classifications are: TSV files for each classification are available for download below.
  • query_lang - The system can accept queries in a number of languages. This parameter specifies the language used for the query text. If this is omitted the query is assumed to be in English (en). If this is any other language than English the query text will be machine-translated to English before semantic search is performed. The list of 100 available languages can be seen in the search form above.
  • apikey - Your API key.
  • output - Either json or html. Default is json. The "html" output is primarily intended for use with Google Sheets since the IMPORTHTML() function can only parse HTML tables, not JSON data.

Using POST:

The endpoint also optionally supports POST requests. The body can be either a JSON body or a FormData body. Use the Content-Type header 'application/json' or 'application/x-www-form-urlencoded' to indicate which type of body is being sent.

Results:

The system returns results in JSON format. If you are using Google Sheets, add the output=html parameter to the request. Here are the details about the two output types.

By default this service generates computer-readable JSON results. The API will return a result with this signature:

interface SemanticSearchResult {
    ok: boolean,
    message?: string,
    search_query: string, /* Search query (in English) */
    matches: SemanticSearchMatch[] /* Up to 5 matches */
}

interface SemanticSearchMatch {
    zero_based_index: number,
    code: string, /* The codename for this sector in the classification */
    label: string,
    cosine_similarity: number
    /* Additional metadata may also be available for individual classifications... */
}
  • code provides the codename for the matching sector.
  • label provides the text label for that matching sector.
  • zero_based_index provides the line index of the corresponding row in the sector list, using a zero-based index where the first line is line 0. Tab-delimted text files containing the list of sectors in each classification system are available in the documentation below.
  • cosine_similarity provides the cosine similarity score for the match.

To use Google Sheets, just add a output=html parameter to your request. The system will then return an HTML page with several tables and these tables can be read by the IMPORTHTML() function in Google Sheets.

To see how to use this feature, use the examples from the Example Google Sheet

Available Classifications

The NACE classification is a European standard classification of economic activities. The NACE2.1 classification is the latest version. This should not be confused with the NACE rev2 (aka NACE2) classification, which is the previous version. More information about the NACE classifications can be found on the NACE2.1 metadata page. That site provides further information about the NACE2.1 classification, as well as a mappings to other classifications, including NACE rev2. This site provides NACE2.1 classifications, at one-digit, two-digit, three-digit, and four-digit levels. These classifications can be viewed here (UTF-8 tab-delimited text files):

The ISICrev4 classification is an international standard classification of economic activities. More information about the ISIC classifications can be found on the UN Statistics Division page. That site provides further information about the ISICrev4 classification. This site provides ISICrev4 classifications, at one-digit, two-digit, three-digit, and four-digit levels. These classifications can be viewed here (UTF-8 tab-delimited text files):

GLORIA is a multi-regional input-output model. It uses a 120 sector classification system based on, but not identical to, the ISICrev4 classification. This site provides the GLORIA 120 sector classification. The full list is available here: gloria_v059.txt (UTF-8 tab-delimited text file).

EXIOBASE is a multi-regional input-output model. It provides supply-use tables for many countries. It uses a product and industry classification system based on, but not identical to, the ISICrev4 classification. Here is the EXIOBASE product and industry classification:

The UN Food and Agriculture Organization (FAO) maintains a database of agricultural statistics called FAOSTAT. This database uses a set of classifications which are described here: https://www.fao.org/faostat/en/#definitions. A complete listing of Item codes can be found in this file: FAOSTAT_data_11-21-2024.csv Some of these classifications are available in this tool. They are: