/sm2gst

An application for testing the TableStructureGraph2MergingSet algorithm!

image

Table Structure Graph (TSG) to Merging Set (MS)

The definition of table structure

Merging Set (MS):

The expression of table structure

Description:

Directed Acyclic Graph (DAG) with 2 kinds of edge labels ("row" and "column"), which is termed as Table Structure Graph (TSG). A vertex refers to a cell in a table, and a row/column edge indicates a horizontal/vertical intersection.

Diagram:

Web API

import requests
import json


def get_merging_set(row_adj_matrix, col_adj_matrix, flags):
    # request results
    url = f"http://<is opening soon...>.gz.apigw.tencentcs.com/release/tsg2ms"
    data = {"matrix1": row_adj_matrix, "matrix2": col_adj_matrix, "flags": flags}
    headers = {
        "Content-Type": "application/json",
        "Accept": "*/*",
        "Cache-Control": "no-cache",
        "Host": "<is opening soon...>.gz.apigw.tencentcs.com",
        "Accept-Encoding": "gzip, deflate, br",
        "Connection": "keep-alive",
        "User-Agent": "apifox/1.0.0 (https://www.apifox.cn)",
    }
    r = requests.post(url, headers=headers, data=json.dumps(data))
    json_data = r.json()
    return json_data.get("result")


if __name__ == '__main__':
    ##################### Inputs #############################
    row_adj_matrix = [[0, 1, -9999, -9999],
                      [-9999, 0, -9999, -9999],
                      [-9999, -9999, 0, 1],
                      [-9999, -9999, -9999, 0]]

    col_adj_matrix = [[0, -9999, 1, -9999],
                      [-9999, 0, -9999, 1],
                      [-9999, -9999, 0, -9999],
                      [-9999, -9999, -9999, 0]]

    flags = {'gt_or_prediction': 'gt',
             'isFAS': False,
             'isDeleteConflicts': False,
             'isDetectVacancy': True,
             'isMIP': False,
             'isComputeSL': True}
    ##########################################################

    api_return = get_merging_set(row_adj_matrix, col_adj_matrix, flags)

    # show results
    if api_return["status"] == "failure":
        print("Invalid Table or Graph!", api_return.get("message"))
    elif api_return["status"] == "success":
        print(api_return)

An APP for testing our API

Description:

Draw your table on paper and annotate its TSG using our tool. After that, click the "Merging Set" button, this tool will compute the merging set of your table!

Download Links:

Version 2 (Recommended) https://doi.org/10.6084/m9.figshare.24633588.v3

Version 1 (Deprecated) Google Drive, 百度网盘

The demonstration video (with voice):

demo+sound_compressed_CN.mp4

Report Bugs

If you have tables with inconsistent merging sets from the tool, there may be implementation bugs in our API program. Please raise an issue and upload images and JSON data for your examples. Thanks a lot!